HTTP Request's Content Encoding field

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

HTTP Request's Content Encoding field

jmeter tea
I tried sending encoding in HTTP Request's Content Encoding
<http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request>
field
but it doesn't seem to have any effect also in POST request

Content encoding to be used (for POST, PUT, PATCH and FILE). This is the
character encoding to be used, and is not related to the Content-Encoding
HTTP header.


Is it a deprecated field or is there any specific usage/effect when
changing the encoding ?
Reply | Threaded
Open this post in threaded view
|

Re: HTTP Request's Content Encoding field

glinius@live.com
It is being used at least:

 1. For  setting request header
<https://github.com/apache/jmeter/blob/v5_0/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java#L315>  
 2. For  encoding POST request data
<https://github.com/apache/jmeter/blob/v5_0/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java#L320>  
 3. For  encoding query string
<https://github.com/apache/jmeter/blob/v5_0/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java#L1121>  

The easiest way of testing this is setting Content Encoding to something,
which cannot be resolved to a  Java Charset
<https://docs.oracle.com/javase/8/docs/api/index.html?java/nio/charset/StandardCharsets.html>
, in this case you will immediately get an  UnsupportedCharsetException
<https://docs.oracle.com/javase/8/docs/api/java/nio/charset/UnsupportedCharsetException.html>  

Another option of testing this is using  View Results Tree
<https://www.blazemeter.com/blog/how-debug-your-apache-jmeter-script>  
listener, if you leave the Content Encoding input blank - JMeter will send
default charset (UTF-8). If you set the encoding of your choice - JMeter
will add this as the  Content-Type header
<https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type>  
*charset* parameter

<http://www.jmeter-archive.org/file/t340375/Screenshot_2018-12-25_at_14.png>





--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: HTTP Request's Content Encoding field

jmeter tea
Thank you for answering my question,
But still, what is the usage of setting a valid value, What is the benefit
over setting Content-Type header parameter?

On Tue, Dec 25, 2018 at 3:59 PM [hidden email] <[hidden email]> wrote:

> It is being used at least:
>
>  1. For  setting request header
> <
> https://github.com/apache/jmeter/blob/v5_0/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java#L315>
>
>  2. For  encoding POST request data
> <
> https://github.com/apache/jmeter/blob/v5_0/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java#L320>
>
>  3. For  encoding query string
> <
> https://github.com/apache/jmeter/blob/v5_0/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java#L1121>
>
>
> The easiest way of testing this is setting Content Encoding to something,
> which cannot be resolved to a  Java Charset
> <
> https://docs.oracle.com/javase/8/docs/api/index.html?java/nio/charset/StandardCharsets.html>
>
> , in this case you will immediately get an  UnsupportedCharsetException
> <
> https://docs.oracle.com/javase/8/docs/api/java/nio/charset/UnsupportedCharsetException.html>
>
>
> Another option of testing this is using  View Results Tree
> <https://www.blazemeter.com/blog/how-debug-your-apache-jmeter-script>
> listener, if you leave the Content Encoding input blank - JMeter will send
> default charset (UTF-8). If you set the encoding of your choice - JMeter
> will add this as the  Content-Type header
> <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type>
> *charset* parameter
>
> <
> http://www.jmeter-archive.org/file/t340375/Screenshot_2018-12-25_at_14.png>
>
>
>
>
>
>
> --
> Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>