legitimate values for ZnClient>>accept:
Hi Sven, I had a sample http request specified to have ```Accept-Encoding: gzip``` and too a guess the following would work... ```client := ZnClient new accept: 'gzip' ``` but it doesn't since ZnClient>>accept: effectively does ``` 'gzip' asZnMimeType ``` which expects the string to contain a forward-slash However this page seems to indicate no slash is required... https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding If I call ```client request setAccept: 'gzip' ``` I am able to match what is expected (checked with WireShark) but I'm not sure the sample I was provided is legit or I'm doing something wrong cheers -ben
Ben,
On 10 Sep 2018, at 20:36, Ben Coman <btc@openinworld.com> wrote:
Hi Sven,
I had a sample http request specified to have ```Accept-Encoding: gzip``` and too a guess the following would work... ```client := ZnClient new accept: 'gzip' ``` but it doesn't since ZnClient>>accept: effectively does ``` 'gzip' asZnMimeType ``` which expects the string to contain a forward-slash
However this page seems to indicate no slash is required... https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding
If I call ```client request setAccept: 'gzip' ``` I am able to match what is expected (checked with WireShark) but I'm not sure the sample I was provided is legit or I'm doing something wrong
cheers -ben
You seem to be confusing two different headers, Accept and Accept-Encoding (there are many more: https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields). #accept: does indeed take a mime-type as argument, as it should. I think you are looking for #setAcceptEncodingGzip Sven
On Tue, 11 Sep 2018 at 02:50, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Ben,
On 10 Sep 2018, at 20:36, Ben Coman <btc@openinworld.com> wrote:
Hi Sven,
I had a sample http request specified to have ```Accept-Encoding: gzip``` and too a guess the following would work... ```client := ZnClient new accept: 'gzip' ``` but it doesn't since ZnClient>>accept: effectively does ``` 'gzip' asZnMimeType ``` which expects the string to contain a forward-slash
However this page seems to indicate no slash is required...
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding
If I call ```client request setAccept: 'gzip' ``` I am able to match what is expected (checked with WireShark) but I'm not sure the sample I was provided is legit or I'm doing
something wrong
cheers -ben
You seem to be confusing two different headers,
Indeed. I plead domestic blindness.
Accept and Accept-Encoding (there are many more: https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields).
#accept: does indeed take a mime-type as argument, as it should.
I think you are looking for #setAcceptEncodingGzip
Yes, thx. cheers -ben
participants (2)
-
Ben Coman -
Sven Van Caekenberghe