sideshowcoder / canned

Server to respond with fake API responses, by using a directory of files for finding out what to say!
213 stars 46 forks source link

Serve custom HTTP headers on responses #69

Closed brendan-rius closed 9 years ago

brendan-rius commented 9 years ago

I would like to be able to add custom HTTP headers on responses so I can fake - for example - the login process (which returns a Authorization header)

sideshowcoder commented 9 years ago

That is possible, take a look at https://github.com/sideshowcoder/canned#variable-responses using the header.

brendan-rius commented 9 years ago

As I understand it, it is possible to change the response being sent depending on the request headers. But I would like to add custom HTTP headers to the request.

I implemented this locally because it could not find it anywhere in the documentation/code

sideshowcoder commented 9 years ago

Ah sorry I see, yes that is currently not possible, yet it has been done specifically for the CORS headers but nothing else so far... PR would be very welcome. https://github.com/sideshowcoder/canned/blob/master/lib/response.js#L34

This would need to be extracted from the file I guess and then added to the response, from a first look it doesn't seem to complicated, as the content header is already passed down this way for example.

brendan-rius commented 9 years ago

PR #70 should solve this