1,708 questions
2
votes
1
answer
15k
views
Fetch in node receiving status code 464 but working in browser
I'm a requesting a url with fetch in my node app and the response status is 464 (without responseText and without any error message). But I could't find any info about that.
Also if I request the same ...
0
votes
1
answer
65
views
Scrapy handle status 202
I'm quite new to web scraping, and in particular in using Scrapy's spiders, pipelines...
I'm getting some 202 status from some spider requests' response, hence the page content is not available yet
...
287
votes
14
answers
585k
views
JAX-RS — How can I return a JSON and HTTP status code together?
I'm writing a REST web application (NetBeans 6.9, JAX-RS, and TopLink Essentials) and trying to return JSON and HTTP status code. I have code ready and working that returns JSON content when the HTTP ...
183
votes
3
answers
72k
views
Difference between HTTP redirect codes
The differences between the various HTTP 3XX redirect codes are not clear to me. Yes, I've read the spec, but there seems to be some discrepancy between the standard and actual practice here.
The ...
1
vote
1
answer
13k
views
Request timeout in nginx
I am getting 499 on server side of my application(on nginx) and 504 on the client side. The default time out for client side is 5000 seconds and the response I am getting is exactly after 60 seconds.
...
-1
votes
3
answers
85
views
What is the correct HTTP status code when the authenticated user’s record is missing in the database (e.g., /user-info endpoint)? [duplicate]
I’m designing a RESTful API endpoint like this:
resource function get user-info(http:RequestContext ctx)
returns database:UserInfo|http:InternalServerError|http:NotFound {
authorization:...
3679
votes
22
answers
1.7m
views
403 Forbidden vs 401 Unauthorized HTTP responses
For a web page that exists, but for which a user does not have sufficient privileges (they are not logged in or do not belong to the proper user group), what is the proper HTTP response to serve?
401 ...
2
votes
3
answers
4k
views
Can't set response code to 200 in PHP
I'm trying to set the response code in a PHP script to 200. Later I set a Location header, which sets it to 302. According to the documentation:
Not only does it send this header back to the ...
43
votes
4
answers
20k
views
HTTP Status Code for Captcha [closed]
Sometimes (when the resource is requested too often) I'm intercepting the presentation of a (HTML) resource with a captcha. The interception doesn't produce any redirection. It happens all at the same ...
2
votes
1
answer
5k
views
How to modify response status and body after committed spring boot
I implemented a rate limiter with Filter.class. However, we encountered that we should not limit successful requests. So, I needed status code of the response. When I get status code in Filter chain, ...
2
votes
1
answer
996
views
In the Firefox DevTools Network tab, how do I see only failed requests?
I want to be able to see all requests that have error responses (of any kind). By that, I mean requests that have a response with a status code like "4xx" or "5xx".
I discovered ...
11
votes
1
answer
14k
views
Distinguishing HTTP status code 403 and 409 in practice (or 400)
Even after reading many documents, books, spec
I couldn't 100% be certain whether I should use http status code 403 or 409 in my case.
Some argue that 403 should be used only with an authorization ...
131
votes
6
answers
481k
views
How do I resolve a HTTP 414 "Request URI too long" error?
I have developed a PHP web app. I am giving an option to the user to update multiple issues on one go. In doing so, sometimes the user is encountering this error.
Is there any way to increase the ...
32
votes
5
answers
30k
views
What HTTP code to use in "Not Authenticated" and "Not authorized" cases?
I read that "401 Unauthorized" code must be used when a user:
Is not logged, but login is required ("not authenticated");
Is logged, but his profile don't allow to see that url ("not authorized");
...
-1
votes
2
answers
101
views
Meaning of Error and httpStatus.statusCode returned from Swift request using URLSession.shared.dataTask
I am doing a POST request using URLSession.shared.dataTask which returns data, response and error. I would think that Error would be the same as a failed request. However, I can get the request to ...
3
votes
1
answer
2k
views
Retry pattern, how to determine type of failure in PHP
I want to implement Retry pattern in PHP (Guzzle) to determine if I need to send the request again in case of failure or not. And in case I need to, should I use some delay before sending it again or ...
157
votes
7
answers
120k
views
What is the appropriate HTTP status code response for a general unsuccessful request (not an error)?
I'm creating a RESTful API that will process a number of user interactions, including placing orders using stored credit cards.
In the case of a successful order, I'm returning a 200 OK, and in the ...
0
votes
1
answer
70
views
How to correctly handle http error code in multi-module compose app?
i'm building a multi-module jetpack-compose login/signup app. My backend is handled using Spring boot and the login/signup function returns a ResponseEntity.
The task: in my frontend i want to display ...
11
votes
4
answers
33k
views
Difference between http response status code 402 and 403
Friends and fellow users,
We have both 402 and 403 http response codes. Though, 402 is reserved for future use.
What is (or would be) the difference between these two. Payment not received should be ...
32
votes
4
answers
19k
views
HTTP status code when single request asks for too large resource or too many of them
Does somebody know which HTTP status code is the right one for the following situation?
An anonymous client requests a range of items from a collection via a RESTful API. The client uses GET method ...
0
votes
2
answers
322
views
google nest thermostat user and rate limits
I now have a project about smart air conditioners, hoping to control the central air conditioner through the nest thermostat. I hope that when the data of the nest thermostat changes, it can be ...
4
votes
1
answer
1k
views
grpc-gateway: return 201 on successful POST
What's the idiomatic way to return an HTTP 201 on a successful POST with grpc-gateway?
Writing a filter function seemed promising, but I'm not sure how to do this generically since I don't have ...
0
votes
2
answers
2k
views
Mocking an HTTP error Observable in Jasmine and RxJS
This question is sort of a duplicate, but since I can't comment on other questions I've had to open a new one.
I'm running into a bug in a jasmine test where a function is supposed to handle an error ...
9
votes
1
answer
3k
views
REST: Resource in wrong state -- Which HTTP status should I return?
Assume my server exposes resources which have a state (Not approved, Approved, Auto-approved). If a resource is in state Not approved it should not be accessible to clients, i.e. clients are allowed ...
0
votes
1
answer
268
views
How to customize the "413 Payload Too Large" response in Quarkus with multipart/form-data requests?
How to customize the "413 Payload Too Large" response in Quarkus with multipart/form-data requests?
I'm working with a Java 21 Quarkus (3.18.1) API that uses the quarkus.http.limits.max-form-...
103
votes
5
answers
75k
views
Is it wrong to return 202 "Accepted" in response to HTTP GET?
I have a set of resources whose representations are lazily created. The computation to construct these representations can take anywhere from a few milliseconds to a few hours, depending on server ...
1
vote
2
answers
47
views
Laravel 9.x different status code while automated testing
One of my automated tests is returning status code 302 whereas it should return 422.
CategoryTest.php
class CategoryTest extends TestCase {
use RefreshDatabase;
...
public function ...
0
votes
0
answers
63
views
How do I get responses from Spotify API after status code 304?
I have started learning about and experimenting with the Spotify API recently. So, I wrote the following code to fetch audio features like acousticness, danceability etc. of my liked/saved songs:
def ...
306
votes
3
answers
120k
views
What's the difference between HTTP 301 and 308 status codes?
What's the difference between HTTP 301 and 308 status codes?
301 (Moved Permanently): This and all future requests should be directed to the given URI.
308 (Permanent Redirect): The request and all ...
17
votes
2
answers
13k
views
Public LinkedIn profile url returns server Status code 999
LinkedIn Consumer Support asked me to add this question here for #LinkedIn developpers to answer this.
I have seen there are multiple questions about this 999 status code, but they are all API ...
0
votes
0
answers
104
views
How to translate the not-found page in Next.JS
My website has translations, and I want to translate my error pages. But I translate my pages with a dynamic route (/app/[locale]) and not-found.tsx must be at the root (app/not-found.tsx). I don't ...
20
votes
3
answers
31k
views
What status code should a PATCH request with no changes return?
If a PATCH request is made with a VALID payload, but the values in the payload are exactly the same as those in db, should it return 200 or 400 or other status code?
6
votes
6
answers
21k
views
Laravel won't obey status code
I just can't understand, and don't know where else to look, as the response status code of the following code is always 200, even if I set it to 400 in the main Response class.
class Api_Controller ...
7
votes
2
answers
1k
views
AWS API Gateway Integration Response - Lambda Error Regex fails matching when response contains new line
I have API Gateway as a trigger to my lambda function. Whenever my lambda raises an exception, it gets matched with the pattern configured in Integration Response. The problem is if the exception ...
11
votes
2
answers
8k
views
what status code to throw when there is a concurrency error?
I have a REST API that receives among other things, a date and with it, makes a reservation. The problem occurs when 2 people "at the same time" try to book on the same day, at the same time....
2
votes
1
answer
2k
views
What would be the best-practice standard for backend response of an expired JWT token? [closed]
So what I found useful is according to MDN's HTTP Response Status Code the status code that can qualify is:
400 Bad Request
401 Unauthorized
406 Not Acceptable
412 Precondition Failed
Now, I was ...
1
vote
0
answers
35
views
api returns 419 xhr error in nextjs and laravel
I am using Nextjs, for frontend and laravel for backend. My Login api works fine in postman, but in frontend it return 419 xhr error. What can I do to fix this?
export const postLogin = async (data: ...
1
vote
1
answer
1k
views
Is HTTP status 202 appropriate for account creation, while waiting for a confirmation code?
I have an API with a 2 step sign-up flow:
user requests a new account (POST with some account information in the body)
user confirms the account (POST with a verification code received via text or ...
2
votes
1
answer
59
views
Filter Network requests by status code in Firefox browser console
How can I show only certain HTTP status codes in the Firefox browser console?
For example, I just want to see a list of all image requests that returned a 404 error. The console has a setting to show ...
18
votes
4
answers
10k
views
When to use HTTP status code 425 "Too Early"
The 425 "Too Early" status code's description:
Indicates that the server is unwilling to risk processing a request that might be replayed
How is it used in a real world scenario? Examples ...
1
vote
0
answers
23
views
How does a response code influence the execution of an API call in Groovy? [duplicate]
New to Groovy, not experienced working with APIs. So my apologies if this is something general and not related with these topics. I just wish to understand it a bit.
I try to trigger a small script ...
0
votes
0
answers
259
views
Google places API returning failed to open stream: HTTP request failed error
I am hoping for some direction on this error. I have a loop that connects with the google places API. Every few times I test it I get an HTTP request failed error. But when I take the API call from ...
2
votes
2
answers
1k
views
what is appropriate status code for wrong email/username when user tries to reset password?
a simple use case - unlogged user tries to reset their password. they provide wrong email or username (but the format of the data is correct).
should I return 400, 412 or 404?
-1
votes
1
answer
68
views
What is the correct status code for a semi-ok response? [closed]
I have a client that is asking the server for n elements. The server is asking ChatGPT for n elements, but sometimes ChatGPT returns n-1 or n+1 elements.
Client Code
const count = 3;
var elements = ...
595
votes
9
answers
796k
views
400 vs 422 response to POST of data
I'm trying to figure out what the correct status code to return on different scenarios with a "REST-like" API that I'm working on. Let's say I have an end point that allows POST'ing ...
-1
votes
1
answer
127
views
499 when using fetch/fetch-node in NodeJS
Stack!
The strange situation I'm facing with. I have a code, that is dead-simple:
fetch('https://www.o2.pl').then((response) => console.log(response.status));
I tried this with
both fetch and ...
0
votes
1
answer
89
views
C# API Controller Returns 400, but fetch in JavaScript hows 422 Status Code - Why?
I'm testing my C# API endpoint and encountering a discrepancy between the status code I return in my controller and what I receive by using fetch. I have configured my C# controller to return a 400 ...
0
votes
1
answer
2k
views
Citrus framework "no matching constant for [520]" - Custom HTTP Status Codes
i've got a problem when I try to run my Citrus v.2.7.5 Tests with an API on a server which responds customized HTTP-Status-Codes to my citrus client. My tests are throwing IllegalArgument Exceptions ...
19
votes
1
answer
8k
views
In Google Apps Script, how can I set the HTTP response code for a service I implement?
Say I have "service" returning a XML document:
function doGet() {
var result = '<result>42</result>';
var output = ContentService.createTextOutput(result);
output.setMimeType(...
71
votes
6
answers
180k
views
HTTP status code for "no data available" from an external datasource
Scenario:
A POST request is sent to process an order that will result in data retrieval from an external datasource.
There are three possible results:
The datasource returned data for the request
No ...