ajax success status code "200" vs "200 OK" [closed] - ajax

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I am facing some issue related to ajax success status code.in local environment ajax success status code return "200" and live website return status code "200 OK"
what is different between both status code.

Hope this will help you!
There is no difference between 200 and 200 ok.
'OK' is just a message with response code 200. In simple term, it is just a success message.
The best part is even you can modify the message(ok) with some interesting message like 'The user has been created.' for the response code 200
Technically, the request was OK and the server was able to respond properly.

Status code and status message are configurable from the back end. I guess your live server is configured to not send a status message

Related

oauth token request errors with "missing required parameter 'client_id'", [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 9 months ago.
Improve this question
I'm trying to get a token from squares oauth. I can successfuly get the code but when i try to get the token i receive the error "missing required parameter 'client_id'".
I can successfully get a token from postman but not sure why oauth2.Exchange is not passing all info to the oauth server when I try to do it programmatically.
here is a gist of my oauth2.Config object: https://gist.github.com/yshuman1/dedaead8568e695df7a06f86cd986c2d
here is a gist of my failing callback function:
https://gist.github.com/yshuman1/2b496e0fe698a5a0df087c60f4583677
Here is a gist of the redirect & callback functions as well as the oauth2.Config object: https://gist.github.com/yshuman1/b3c472978a4b1b73d6668dfe583f440f
In the callback gist, i also attempted passing in context.TODO() instead of context.Background().
any advice would be appreciated!
I've tried passing the missing items in but not sure what to do to get it done correctly.
I expect to receive a oath token back but dont. I'm getting the error
{
"message": "missing required parameter 'client_id'",
"type": "bad_request.missing_parameter"
}
i ended up solving this by replacing the .Exchange method used to obtain a token with a simple http.POST request to obtain it.
Set the parameter as
{"client_id":client_id}
Pass this JSON object as parameter.

Authorization headers not working with cors [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I've been facing this issue for several days now. I'm trying to make a call to my API (api.mywebsite.com) from my website (mywebsite.com), and it works fine until I try to pass the Authorization header. At that point, it's not a simple request anymore, but a preflighted request.
However, at the end the auth headers are not sent, and the input I get is this one:
This is my front end code (JS):
fetch(generalInfo.url.api+"users/"+userId, {
method: 'GET',
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"Authorization": "Bearer "+accessToken
},
withCredentials: true
});
While this is a middleware in the API backend:
//Allow the cors from every domain
module.exports = function (req, res, next){
res.setHeader('Access-Control-Allow-Origin', req.host);
res.setHeader('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Authorization');
if(req.method === 'OPTIONS'){
return res.send(200);
}
next();
}
Can anybody help me?
According to https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
In particular, a request is preflighted if any of the following conditions is true:
If, apart from the headers set automatically by the user agent (for example, Connection, User-Agent, or any of the other header with a name defined in the Fetch spec as a “forbidden header name”),
The forbidden headers include:
https://fetch.spec.whatwg.org/#forbidden-header-name
Which has Access-Control-Request-Headers which we can see is being sent with your request. This explains the use of a preflight.
I think the process looks ok - but in your response headers to the preflight i notice the access control allow origin is api.myapp.com whereas in the request if was on port 8888. I think in the response you should have the port number if it's not 80 for http. See https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy. An origin is the same if:
Two pages have the same origin if the protocol, port (if one is specified), and host are the same for both pages. You'll see this referred to as the "scheme/host/port tuple" at times (where a "tuple" is a set of three components that together comprise a whole).
So i think the issue might be that your preflight is saying to the client that only api.myapp.com is allowed but the actual request might be made to http://api.myapp.com:8888 so the origins don't match. Or have I misunderstood what you are trying to do?
You must remove "8888" port of your api url, the api server has to have already a port setted for api.myapp.com address

Cal Web API with headers authorization [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I request web api from html view with header authorization
But unfortunately when i put this section headers
{authorization:'basic fdgxvgxsa='}
in my ajax request it is not make any request
My ajax call is as following
$.ajax{
Url:http/localhost:1234/api/isuserauthinticated
Headers:{'authorization..... '}
You can use beforeSend function to set you autherization headers in .
$.ajax({
type: "POST",
beforeSend: function(request) {
request.setRequestHeader("authorization", authorizationToken);
}
});

Finding difficulty in understanding Jmeter functionality [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have recorded one scenario in JMeter. Scenario is, I will login to the application, perform some Registration and logout. when i run/execute this, Login is failing for some reason(i have figured out login failure issue), but my question is, 'Registration' part is executing successfully. whatever 'Success' i am receiving for registration without login, is a correct functionality of the jmeter? i am very new to jmeter, trying to understand how it works.
One more question is, when i execute more than 1 thread(may be 100 or 1000), how does it do the load testing(Does it actually inserts data/values into the database)?
JMeter automatically treats HTTP Status Codes below 400 as successful, so i.e. if HTTP Request sampler gets HTTP Status 200 - OK - JMeter will "think" that everything is fine.
So if you need to add validation of the response data, i.e. whether it contains Welcome text or does not contain Error text you can add a Response Assertion to implement pass/fail criteria in your JMeter test.
Similarly you can use JDBC PostProcessor to validate whether required data is present in the database, check out The Real Secret to Building a Database Test Plan With JMeter guide to learn how to set up JMeter for DB connectivity and execute queries.
JMeter doesn't have any server logic, It just sends requests as defined by user.
The logic is in your server, If it allows registration without login (which seems ok) it will allow it and insert data to your database.
Load test will send similar request in a bulk, so same server logic will be executed, and if server won't block it, it will execute same flow as executing 1 thread which will probably include also inserts data into the database
Lakshmikanth,
You need to follow below steps when you are developing new scripts in JMeter:
Record your scenario through JMeter proxy
Look for the dynamic variables such as session id or token and correlate them
Add assertions [JMeter mark the request as pass or fail based on the response code ie. 200, 400 etc so its important that you set the assertion at every step otherwise the JMeter will mark the request as pass if it receive 200 response code similar to your case of registration]
Run script single & multiple users with 'Results View Tree' element enabled.
The above steps will help you to make a concrete JMeter scripts.

Configuring Firefox 3.0.x to send a Kerberos token [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 13 years ago.
Improve this question
I'm trying to convince Firefox 3.0.14 to send a Kerberos token. I have configured the service correctly and IE will send a Kerberos token (i.e. starting YI..), but after adding the hostname to the network.negotiate-auth.trusted-uris and network.negotiate-auth.delegation-uris settings in about:config, Firefox only sends an NTLM token. Here's the (cut down) output from Live Headers:
to server ->
GET /testsso.jsp HTTP/1.1
<- from server
HTTP/1.x 401 Unauthorized
WWW-Authenticate: Negotiate
to server ->
GET /testsso.jsp HTTP/1.1
Authorization: Negotiate TlxxxxxxxxQ=
<- from server
HTTP/1.x 401 Unauthorized
WWW-Authenticate: Negotiate
The server is only interested in a Kerberos token, i.e. one starting in YI, so issues the Unauthorized on the second request, at which point Firefox gives up.
I'm using Windows 2003. Any thoughts?
J
Kerberos is disabled on a default firefox.
You can enable it, check out the guide here:
http://grolmsnet.de/kerbtut/firefox.html

Resources