Not able to submit image with POST method using jmeter - performance

My Http Request
My Header Manger
I am getting error code as 400 - BAD REQUEST
Thread Name:Thread Group 1-1
Sample Start:2021-03-20 06:20:18 GMT
Load time:551
Connect Time:40
Latency:551
Size in bytes:336
Sent bytes:652
Headers size in bytes:144
Body size in bytes:192
Sample Count:1
Error Count:1
Data type ("text"|"bin"|""):text
Response code:400
Response message:BAD REQUEST
HTTPSampleResult fields:
ContentType: text/html; charset=utf-8
DataEncoding: utf-8

As per 400 Bad Request description:
The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
The client should not repeat this request without modification.
so it means that the request you're sending is malformed somehow, i.e. incorrect path or missing header or invalid/incorrect/missing parameter(s)
If you can execute the request manually using browser you should be able to record the request using JMeter's HTTP(S) Test Script Recorder, just make sure to copy the file you're uploading into the "bin" folder of your JMeter installation, this way JMeter will be able to properly generate the HTTP Request sampler and HTTP Header Manager.
See Recording File Uploads with JMeter article for more details.

Related

Getting 400 bad request when uploading attachment on Jmeter

I recorded uploading an attachment (pdf file) using blazemeter plugin, then open the jmx file using Jmeter. I modified uploads tab as in the following image and placed pdf file under bin directly. when i run the script i got 400 bad request , could you please advise what might be the issue?
As per 400 Bad Request status code description:
The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, or deceptive request routing).
So I would recommend using a 3rd-party sniffer tool like Fiddler or Wireshark to capture the requests originating from JMeter and the real browser and compare them.
Requests must be exactly the same (apart from dynamic parameters which need to be correlated), once you amend your JMeter configuration so it will send the same request as the real browser does your file upload will be successful.
We cannot suggest anything meaningful unless we see successful and failing requests dumps fully (URL, headers and body)

I am getting 401 and 419 error in view results tree while testing my web application in Jmeter

Thread Name:Thread Group 1-1
Sample Start:2022-07-07 21:49:33 IST
Load time:815
Connect Time:0
Latency:815
Size in bytes:8118
Sent bytes:1831
Headers size in bytes:1483
Body size in bytes:6635
Sample Count:1
Error Count:1
Data type ("text"|"bin"|""):text
Response code:419
Response message:
HTTPSampleResult fields:
ContentType: text/html; charset=UTF-8
DataEncoding: UTF-8
HTTP Status 401 means Unauthorized
HTTP Status 419 is not in the standard so it's something custom. If you're trying to test an application built on Laravel it means that you don't properly handle CSRF tokens.
The solution for both is correlation. When it comes to modern web applications it's not possible to just replay the recorded script because they rely on many dynamic parameters starting from Cookies and ending with CSRF tokens. The latter ones need to be handled manually like it's described in JMeter Regular Expression Extractor: How to Extract Tokens and Session IDs to Variables article

Post Request getting failed due to webkitformboundary in JMeter

We have a recorded script using Blaze Meter(HTTPS call) and run in JMeter, One POST request getting failed and shows "500 Internal Server error". In Post request, JSON passed in form of "form-Data" as parameter. When endpoint executed we observed Webkitformbounday in HTTP header, Please give some solution for
HTTPs Request
HTTP Header Manager
POST Request Body
enter image description here
It looks like the recording solution you're using isn't very suitable for building proper HTTP POST request, I would suggest the following amendments:
Untick Use multipart/form-data box in the HTTP Request sampler
Remove issueDetail parameter name and put it to the end of "path"
Change Content-Type header value to application/json
Authorization header value might need to be correlated if the token life span is short
More information: Testing SOAP/REST Web Services Using JMeter

http upgrade failed with status code 400 in jmeter websocket sampler

I have used the websocket open connection sampler request in my project.
URL: wss://sip-qa.forestreettelco.com:11443
while executing the jmeter script getting the Response message:"http upgrade failed with status code 400"
Please help me.enter image description here
As per HTTP Status Code 400 description
The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
So my expectation is that you're sending the wrong request which doesn't match what your server expects. As it is not publicly available I cannot come up with the proper configuration, however I believe you should start with normal HTTP Request sampler and add the following Headers to the request:
Connection: Upgrade
Upgrade: websocket
Whatever other headers which real browser sends like Sec-WebSocket-Protocol, Sec-WebSocket-Version, Sec-WebSocket-Key, etc.
The headers can be added using HTTP Header Manager
You can capture browser traffic using built-in browser developer tools or an external sniffer tool like Wireshark.
Once you will be sending the same sequence of the same requests you should get the same responses as for the real browser.

JMeter http request works via fiddler but not without

I have a simple thread group with HTTP requests as below:
Do Login - POST request
grab the authorization bearer token
Get eventId - GET request
This is a simple HTTP GET request like this http://server_ip:8080/rest/v1/events/1234567
Pass the authorization bearer token in HTTP Header Manager
When I run the above, the Login post request goes through fine. I get a 200 OK and the response header ad message looks fine.
But the 'Get eventId' request fails and returns a 400 Bad Request.
However when I start JMeter to go through the proxy like below, the 'Get eventId' request returns a 200 OK and the response looks as expected.
jmeter.bat -H 127.0.0.1 -P 8888
I am not sure what I am doing wrong?
As per 400 Bad Request status code description:
The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server could not understand the request due to invalid syntax.
Most likely you need to add HTTP Header Manager to send Content-Type header with the value of application/json (or whatever MIME type server expects).
If this is not the case - inspect what is being sent in both cases using View Results Tree listener and amend JMeter configuration so requests would look exactly the same (apart from dynamic token)

Resources