ethanent / phin

Node HTTP client
MIT License
576 stars 33 forks source link

Options persisting between successive calls when using phin.defaults() #46

Closed bdr99 closed 4 years ago

bdr99 commented 4 years ago

When using an instance created from phin.defaults(), any options passed will persist between successive calls.

For example:

const phinInstance = phin.defaults({
    url: "https://httpbin.org/get"
});

await phinInstance({
    method: "GET",
    headers: {
        foo: "bar"
    }
});

await phinInstance({
    method: "GET"
});

Expected result: the first HTTP request should be sent with header "foo": "bar", and the second one should not.

Actual result: both HTTP requests are sent with header "foo": "bar".