rspec_api_documentation icon indicating copy to clipboard operation
rspec_api_documentation copied to clipboard

Response headers and their consistency

Open Draiken opened this issue 13 years ago • 4 comments

So, the problem here is with environments. Since the docs are generated in the test environment, the response headers will almost never match the production headers.

Things like cache control, ETag, last-modified, etc. are going to be very different.

Right now I didn't find a way to describe response headers or any way to filter them.

I'd like to propose showing only the headers that are consistent between environments, like content-type and the status code. Or if that's not possible to guess, at least have a filter of some kind to explicitly tell the docs which headers can be relied upon.

Maybe something like:

response_headers [:cache-control, :content-type]

Having headers on the doc that are not on the real API is very confusing and can lead to developers relying on unreliable headers.

Draiken avatar Nov 25 '13 14:11 Draiken

:+1: , inconsistants headers could lead to misinterpretations. Maybe passing headers to filter in the configure block like this config.headers_to_filter = [] ?

sush avatar Dec 02 '13 13:12 sush

:+1: for filtering response headers

jandillmann avatar Jan 10 '14 10:01 jandillmann

This was fixed with two new config options #request_headers_to_include and #response_headers_to_include.

oestrich avatar Jul 18 '14 14:07 oestrich

I think it would be nice to have blacklist. I know list of headers that make most noise and not necessary in documentation, but i may easily forget about some special header in some special test (or add it and remove test later, forgetting about header in the config). I would prefer to specify which headers i always want to filter. Developer who read my api documentation may get used to completely ignore my headers information, simple because there's too much noise headers.

Fedcomp avatar Jun 08 '16 10:06 Fedcomp