Getting Response Code '404' when run HTTP requestt - jmeter

. I'm a newbie of JMeter
. I'm trying to get HTTP request to view page 'https://....', but getting error Response Code '404', I don't know why.
[1] https://i.stack.imgur.com/o0ruk.png ]
[2] https://i.stack.imgur.com/718C6.png ]
[3] https://i.stack.imgur.com/CLn8k.png ]

Related

Laravel Form Validation Inconsistency

Laravel Version: 9.42.0
PHP Version: 8.1.13
Database Driver & Version:
Description:
Before laravel 9 update, form rules were working as I wanted. It started behaving differently after the update.
While the same code and the same request occur without an error in laravel 8, error code 422 is returned in laravel 9.
Steps To Reproduce:
Route::post('test', function (\Illuminate\Http\Request $request) {
$request->validate([
'type' => [
'bail',
'exclude_if:type,',
'in:individual,corporate',
],
'name' => [
'bail',
'exclude_if:type,',
'required_with:type',
'min:3',
'max:49',
],
'id' => [
'bail',
'exclude_if:type,',
'required_with:type',
'digits:10',
],
'tax_office' => [
'bail',
'exclude_unless:type,corporate',
'required_if:type,corporate',
'min:2',
'max:99',
],
], $request->all());
});
Request:
curl --location --request POST 'https://site.dev/api/test' \
--header 'Accept: application/json' \
--header 'X-Requested-With: XMLHttpRequest' \
--header 'Content-Type: application/json;charset=UTF-8' \
--form 'type=""' \
--form 'name=""' \
--form 'id=""' \
--form 'tax_office=""'
Laravel 8.21.0 response status code: 200
Laravel 9.42.0 response status code: 422
Error code 422 with validation in Laravel means the request didn't pass the validation. You would have to debug it further to see which field in the payload is causing the issue by inspecting response errors.
If you got code 200 in a previous version, either you are providing it with different payload which was valid, or something changed between the two versions with the types of rules you are using.
If I had to guess I would say the problem is with the payload data you are providing, and likely before when you got code 200, you were testing with different payload or alternatively maybe you weren't using CURL to test before but instead through the browser.
You can check here to see if any of these upgrades may have had an impact: https://laravel.com/docs/9.x/upgrade
Laravel sends HTTP 422 upon a validation failure ... but, which field failed validation? And, what was the message? (check the response body).
HTTP 200 means the request succeeded — since you don't specify a return or return response() in your controller, HTTP 200 is the default response.
Your usage of 'exclude_if + required_with' seems a bit weird ... perhaps in Laravel updated the logic to fix a bug? (You might try just using required vs required_with).
I'd also try loading that request (import the CURL) into some IDE to help with debugging — Postman How to import

Youtube playlistItems list API sometimes works, sometimes throws 404

I have retrieved upload Id from a channel as shown here(https://www.youtube.com/watch?v=RjUlmco7v2M&t=2s),
and using it as playlitstId here https://developers.google.com/youtube/v3/docs/playlistItems/list#try-it
Sometimes it gives 200, sometimes 404,
Response {_body: "{↵ "error": {↵ "errors": [↵ {↵ "domain":
"yo…003c/code\u003e parameter cannot be found."↵ }↵}↵", status: 404,
ok: false, statusText: "OK", headers: Headers…}
Additional info:
I have selected part as contentDetails,id,snippet
maxResults 50
You may check in this documentation the possible reasons why you got a 404 error in PlaylistItems: list. These methods could also return errors listed in the Common errors section.
notFound (404)
playlistNotFound
The playlist identified with the request's playlistId parameter cannot be found.
notFound (404)
videoNotFound
The video identified with the request's videoId parameter cannot be found.
required (400)
playlistIdRequired
The subscribe request does not specify a value for the required playlistId property.
However, if it doesn't solve your issue and you think that it is a bug, you can file a report here.

Kony service giving 1012 opstatus Request failed error and not giving response

I have a kony sample app where I am trying to do a build and the app has one web service in it for fetching categories of some product. I have the following code also that I wrote:
function GetCategories() {
var inputparam = {
"appID": "bbuy",
"serviceID": "GetCategories",
"catId": "cat00000",
"channel": "rc",
"httpheaders": {}
};
kony.net.invokeServiceAsync("http://192.168.42.134/middleware/MWservlet",inputparam, serv_GetCategoriesCallback);
}
I am getting no response for this. Getting 1012 opstatus and the message is saying "Request failed" error.
kony.net.invokeServiceAsync("http://192.168.42.134/middleware/MWservlet",inputparam, serv_GetCategoriesCallback);
In the above line, you have not given the port number in the MWservlet URL.(e.g. 8080) Give that and check.
Also, make sure all input params are being fed to the service and that they correspond to the exact naming convention followed in the service editor.
Visit :
Find the below link. i hope it gives you a solution
http://developer.kony.com/twiki/pub/Portal/Docs/API_Reference/Content/Network_APIs.htm#net.invo2
Check the mandatory and optional fields of Inputparam

Grails exception handling in URLMappings.groovy for AJAX error

I have a Grails application that makes HTTP requests to a back end server for it's data. That server can be taken down for maintenance, and when that happens it will return a "site down" message to the Grails app in the HTTP response. The Grails app is detecting this and throws a custom SiteDownException. In URLMappings.groovy this is then directed to a specific error page.
This works well apart from for AJAX requests. What seems to happen is that the "site down" URL mapping is triggered (as expected) followed by the catch all '500' mapping.
URLMappings.groovy
"500"(controller: "error", action: "siteDown", exception: SiteDownException)
"500"(controller: "error", action: "error500")
ErrorController.groovy
def siteDown() {
println ">>>> site down <<<<"
}
def error500() {
println ">>>> 500 <<<<"
}
The error is thrown using
throw new SiteDownException()
For regular requests the stacktrace shows...
[11/11/13 16:52:50.945 error] SiteDownException occurred when processing request: [POST] /portal/contact/detail - parameters:
fileKeyIdentifier:
mode: add
Stacktrace follows: [org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver http-bio-8080-exec-6]
com.ui.exceptions.SiteDownException
at com.ui.backend.Backend$$EOMu30qx.getResponse(Backend.groovy:118)
at com.ui.backend.Backend$$EOMu30qx.getResponseAsDomainObject(Backend.groovy:41)
at com.ui.contact.ContactService.detail(ContactService.groovy:166)
at com.ui.contact.ContactController.detail(ContactController.groovy:87)
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:195)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
>>>> site down <<<<
Spot on, but for AJAX requests...
[11/11/13 16:54:09.380 error] SiteDownException occurred when processing request: [POST] /portal/contact/searchBody
Stacktrace follows: [org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver http-bio-8080-exec-7]
com.ui.exceptions.SiteDownException
at com.ui.backend.Backend$$EOMu30qx.getResponse(Backend.groovy:118)
at com.ui.backend.Backend$$EOMu30qx.getResponseAsDomainObject(Backend.groovy:41)
at com.ui.contact.ContactService.searchBody(ContactService.groovy:55)
at com.ui.contact.ContactController.searchBody(ContactController.groovy:23)
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:195)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
>>>> site down <<<<
>>>> 500 <<<<
The last bit is key - it displays the "site down" message from the siteDown action, and "500" from the catch all error500 action.
Can anyone help explain why are both mappings being called for AJAX errors? Thanks
I've found the problem. I had an error trap in the jQuery AJAX wrapper:
error: function(XMLHttpRequest,textStatus,errorThrown){
window.location.href = config.contextPath + '/error/error500'; // Error - show the 500 error page
}
So the SiteDownException was correctly firing the SiteDown mapping, then the AJAX error handler was firing error500 mapping.

log stack trace when HTTP request return error in Jmeter

I want to log all error message for failed HTTP request. I am going to run the thread group for 1B users and I don't want to use the View Result Tree because it logs everything and log file will bloat.
Currently I am using Beanshell Assertion as below.
if (Boolean.valueOf(vars.get("DEBUG"))) {
if (ResponseCode.equals("200") == false) {
log.info(SampleResult.getResponseMessage());
log.info("There was some problem");
}
}
But in this case it just prints the error message but I am interested to log the stack trace returned by the server.
I also used this method as mention in this thread
for (a: SampleResult.getAssertionResults()) {
if (a.isError() || a.isFailure()) {
log.error(Thread.currentThread().getName()+": "+SampleLabel+": Assertion failed for response: " + new String((byte[]) ResponseData));
}
}
But in this case I don't get an object out of SampleResult.getAssertionResults() method and it doesn't display anything in case of HTTP request failure.
Any idea how to get the stacK trace?
I figured it out. SampleResult has one more method called getResponseDataAsString(). This method returns the response message. In case of error it contains the error message.

Resources