slumber icon indicating copy to clipboard operation
slumber copied to clipboard

format is not taken into account

Open kspeeckaert opened this issue 9 years ago • 1 comments

Resource.__call__() has an argument format, that should be used to get the correct content type and add it to the headers when performing the request.

If you look at the code for Resource._request(), it set the accept header to the correct content type by executing serializer.get_content_type(). However, the value passed to format (which is stored in self._store['format']), is not passed to the get_content_type() function, which causes get_serializer() to return the default serializer. This in turn will cause the accept header to be set to the content type of the default serializer.

TL;DR:

  • The format option isn't used
  • The default format specified when creating the API object will always be used to set the accept header (defaults to JSON).

kspeeckaert avatar Jul 05 '16 11:07 kspeeckaert

@kspeeckaert greetings! We've made a fork and PR fixing this (but no tests covering this yet). But I don't know if this package is still maintained.

@samgiles can we reach you out?

Upd.: added test (I am not sure about styling though)

amureki avatar Aug 22 '18 15:08 amureki