Sent request with no User-Agent header

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

Sent request with no User-Agent header

Antony Bowesman-2
Using JMeter 3.3

How can I send an http request without a User-Agent header.

I have a HeaderManager for the request, but if I don't specify as UA header, it sends something like

User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_102)

whereas if I specify User-Agent as an empty value, it will send an empty UA header.

It seems like HttpProtocolParams will add the http.useragent default property, so will effectively mandate the UA header.

Antony


Reply | Threaded
Open this post in threaded view
|

Re: Sent request with no User-Agent header

glinius@live.com
As per  HttpClient JavaDoc
<http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/DefaultHttpClient.html>  


> This class sets up the following parameters
*
> if not explicitly set
*
> :
>
> Version: HttpVersion.HTTP_1_1
> ContentCharset: HTTP.DEFAULT_CONTENT_CHARSET
> NoTcpDelay: true
> SocketBufferSize: 8192
*
> UserAgent: Apache-HttpClient/release (java 1.5)
*

I don't think there is an easy way of disabling this (unless you would like
to go for  Reflection
<https://www.oracle.com/technetwork/articles/java/javareflection-1536171.html>
)

If you don't want the User-Agent header you can switch to "Java"
implementation, the setting lives under "Advanced" tab of the HTTP Request
sampler (or even better  HTTP Request Defaults
<https://www.blazemeter.com/blog/why-its-so-important-use-jmeters-http-request-defaults>
, this way the setting will be applied to all the HTTP Request samplers in
its scope and you will not have to revisit each one individually)  

Also be aware that according to JMeter Best Practices  you should always be
using the latest version of JMeter
<https://jmeter.apache.org/usermanual/best-practices.html#use_latest_version>  
so consider upgrading to JMeter 5.0 (or whatever is available at  JMeter
Downloads <https://jmeter.apache.org/download_jmeter.cgi>   page) on next
available opportunity




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

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