@nodifier/postman
v0.0.2
Published
Wrap functionality the native nodejs request module to support async await
Downloads
2
Maintainers
Readme
@nodifier/postman
Wrap functionality the native nodejs request module to support async await
How to use?
You can import the module to your code as follows:
import { request } from "@nodify/postman";
request
- General example
import { request } from "@nodify/postman";
const result = await request(
"http://test.local/v1/service", // Request endpoint
cut.Method.post, // Request method
{}, // Request headers
JSON.stringify({
test: "test",
}) // Request payload
);
- Making compressed example (using gzip)
import { request } from "@nodify/postman";
const result = await request(
"http://test.local/v1/service", // Request endpoint
cut.Method.post, // Request method
{
"accept-encoding": "gzip"
}, // Request headers
JSON.stringify({
test: "test",
}) // Request payload
);