Skip to content
This repository has been archived by the owner on Oct 16, 2022. It is now read-only.

Set a default User-Agent header when making Request objects #12

Open
akhra opened this issue Jul 12, 2018 · 3 comments
Open

Set a default User-Agent header when making Request objects #12

akhra opened this issue Jul 12, 2018 · 3 comments

Comments

@akhra
Copy link
Contributor

akhra commented Jul 12, 2018

An ops-minded coworker pointed out that this was missing from my Magicbane-powered requests. There should be some default, since a lot of APIs will reject any request without one.

@valpackett
Copy link
Owner

hah wow you're actually using this client :)

We'll need some actual "set header" functionality in that case… e.g. currently the form/json functions replace all headers with Content-Type. (Wait, maybe a User-Agent is already present on defaultRequest and this is what removes it?)

@akhra
Copy link
Contributor Author

akhra commented Jul 12, 2018

Ah, that's very likely -- I'm sure I remember there being a default set when I used http-conduit a few projects back. I've got a function in my local codebase that's roughly union newHeaders existingHeaders, I'll see about making it generic and sending a PR tomorrow.

@akhra
Copy link
Contributor Author

akhra commented Jul 12, 2018

Unfortunately there is no User-Agent in defaultRequest. But #14 makes it far easier to add one downstream, and also prevents postForm/postJson clobbering headers added before their use.

I didn't directly address this for now, to avoid messing with style/structure too much -- e.g. I'm not sure if having unqualified export lists is a priority -- and also I have no idea what the agent string should be.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants