legitimate values for ZnClient>>accept:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

legitimate values for ZnClient>>accept:

Ben Coman
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...

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
Reply | Threaded
Open this post in threaded view
|

Re: legitimate values for ZnClient>>accept:

Sven Van Caekenberghe-2
Ben,

> On 10 Sep 2018, at 20:36, Ben Coman <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: legitimate values for ZnClient>>accept:

Ben Coman


On Tue, 11 Sep 2018 at 02:50, Sven Van Caekenberghe <[hidden email]> wrote:
Ben,

> On 10 Sep 2018, at 20:36, Ben Coman <[hidden email]> 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