Hi >there is no redirect but this behaviour was caused by a record existing for the customer_number ok.. Its not actually possible for this to occur without a redirect - JMeter will post to the URL provided in your script and the only way for the url to change is if the application redirected it (or your script itself did something)
On Wed, Oct 21, 2015 at 12:21 AM, Bhadauria, Tarun Kumar < [email protected]> wrote: > there is no redirect but this behaviour was caused by a record existing for > the customer_number I had provided. > Yet seems strange as I would have expected API to throw error for an > existing record. > thanks for your response. > > Thanks > Tarun K > > On Tue, Oct 20, 2015 at 6:41 PM, Deepak Shetty <[email protected]> wrote: > > > Is there a redirect somewhere ? if JMeter has redirect automatically or > > follow redirects checked then uncheck it and see. > > > > On Tue, Oct 20, 2015 at 5:09 AM, Bhadauria, Tarun Kumar < > > [email protected]> wrote: > > > > > I am using post call on json API, the request is - > > > > > > The API I used in HTTP Sampler is - > > > > > > <API>/api/customers/ > > > > > > On running the test I get following under "Request" tab of "View > Results > > > Tree" - > > > > > > ################################################################ > > > POST <API>/api/customers/42 > > > > > > POST data: > > > { > > > "customer_number": "42", > > > "email": "[email protected]", > > > "encrypted_password": "z3cr37", > > > "enabled": true > > > } > > > > > > [no cookies] > > > > > > Request Headers: > > > Content-Length: 129 > > > Connection: keep-alive > > > Content-Type: application/json > > > ################################################################ > > > > > > Notice that path is changed to <API>/api/customers/42 even though I > only > > > have <API>/api/customers/ in the sampler. > > > > > > And the "Response" tab of "View Result Tree" gets me - > > > > > > ################################################################ > > > {"type":"about:blank","title":"Method Not > > > Allowed","status":"METHOD_NOT_ALLOWED","detail":"Request method 'GET' > not > > > supported"} > > > ################################################################ > > > > > > To debug more, I removed - "customer_number": "42", from data as this > > gets > > > added to API URL and now I get the expected error that > "customer_number" > > > field is missing - > > > > > > ################################################################ > > > {"type":"about:blank","title":"Bad > > > Request","status":"BAD_REQUEST","detail":"Missing fields: > > > [customer_number]"} > > > ################################################################ > > > > > > Did I miss anything here? > > > I am using JMeter 2.13 > > > > > > By the way, I can use curl format as specified here to call the API - > > > > > > > > > http://stackoverflow.com/questions/7172784/how-to-post-json-data-with-curl-from-terminal-commandline-to-test-spring-rest > > > > > >
