e14n / webfinger

Webfinger client library for Node.js
Apache License 2.0
40 stars 10 forks source link

Improve accept header #29

Open rburns opened 7 years ago

rburns commented 7 years ago

Adds accept header to requests made via the template function.

Without the accept headers these requests would sometimes fail with an unexpected content type error. This happens when a server provides an lrdd from host-meta, which specifies a type that differs from the default response type of the given URL.

Also, changes the expected webfinger response content-type from application/json to application/jrd+json

strugee commented 7 years ago

@evanp code LGTM but I don't know Webfinger well enough to tell how this affects the protocol

rburns commented 5 years ago

this pull request had originally changed the webfinger content-type to the newer application/jrd+json After some testing on a variety of servers that implement webfinger (https://github.com/rburns/webfinger-sanity-check/blob/master/index.js), it seems both the newer and older application/json are still used.

I've updated this to support both. leaving the existing tests against the old content-type, and adding one test for the new content-type.