Questions tagged [http-status-codes]
HTTP status codes are a set of standardized codes returned in an HTTP web response. Questions about why a service is (unexpectedly) returning a status code should not use this tag.
1,696
questions
0
votes
1
answer
45
views
PHP http_response_code doesn't seem to work. I *must* be doing something wrong
Building a webhook receiver in PHP 7.4.30.
I can receive absolutely fine. No problems there :-)
However, we need to carry our synchronous validation on the JSON and send back a 400 bad request and a ...
-4
votes
0
answers
14
views
my script monitors website's statuscode but gets the wrong statuscode (404 when there is 200)
import requests
import time
while True:
url = 'https://www.udemy.com/'
response = requests.get(url,verify=False).status_code
print(response)
time.sleep(30)
I made a script which ...
0
votes
1
answer
29
views
When and Why Should I Use the HTTP 304 Not Modified Status Code in a Spring Application?
I'm currently working on a Spring application and I've come across the HTTP 304 Not Modified status code. While I understand its basic purpose, I'm struggling to grasp real-life scenarios where it ...
0
votes
1
answer
42
views
Return a non-200 Http Status from a .net lambda - without an API Gateway
I'm trying to return other http status codes from .net using amazon.lambda.core - I tried this as a handler:
public async Task<string> Handler(string input, ILambdaContext context)
{
...
0
votes
0
answers
13
views
Getting a 404 Error When Making an API Request - Node.js Express
I'm encountering a 404 error when making an API request in my Node.js Express application, and I'm looking for assistance in troubleshooting and resolving this issue.
Problem Description:
I have an ...
0
votes
1
answer
18
views
What HTTP response code to use to signal to a client that a new version is available?
I manage an application that has an irregular update schedule that requires live fixes and also deals with realtime data. I want to notify clients (currently just web clients) that a new version is ...
0
votes
0
answers
18
views
Why accessing HTTP status code from Websocket handshake is a security concern?
When connecting through Websocket protocol from a browser, accessing the HTTP handshake is forbidden.
Is everything goes well, the server answer HTTP 101 Upgrade and the handshake is done.
If the ...
-2
votes
1
answer
25
views
What are the Best Practices for the HTTP Status Codes for Merged Resources? [closed]
We have a REST API endpoint that serves persons api/person/{ID}. Sometimes there are duplicates in the DB, that get merged when they're discovered, so one of the entries is deleted and its data merged ...
0
votes
0
answers
18
views
Rate-limiting with Kong Gateway based on the return HTTP status code other than 200
I need to limit the number of calls to a single API based on the return HTTP status code with Kong.
For example, if the API repeatedly returns a response other than 200, more requests to this API must ...
0
votes
0
answers
32
views
Airflow does not reflect status of GCP Cloud Run job once complete
I have an Airflow DAG (GCP Composer) that invokes a Cloud Run job using HTTPS POST.
I am using a PythonOperator to invoke the Cloud Run job as follows:
run_report_task = PythonOperator(
...
0
votes
1
answer
32
views
Resource Limit Is Reached or HTTP Error 503 Service Unavailable in every site
i am currently working on a worpress site, as i was scrolling on the products page, the page got very slow, and after some times it would be stuck and take a lot of time to load other products, then ...
0
votes
2
answers
54
views
How to get HTTP status errors from cURL 8.0?
When testing some REST API, I'm using a cURL command.
However when the request failed, it seems that cURL does not indicate that there was a non-success status code (HTTP/2 405 in my case); instead I ...
0
votes
0
answers
63
views
Spring Boot default exceptions automatically mapped to a http status code
In my spring boot rest api app,I want to define a automatic method for unhandled exception.Suppose client give wrong password in login endpoint.The response is 403 forbidden without any message.but i ...
0
votes
3
answers
50
views
When building a REST API, must I use status codes?
I'm developing a web application that has a backend API, which is going to be primarily used by a reference frontend application, but other clients can use it too.
The data my API sends has a specific ...
0
votes
0
answers
21
views
Status Code to return for refresh token validation successfull, but user not found?
I'm building an Api with Jwt token auth, in my refresh token method i validate the token using the official JwtSecurityTokenHandler.ValidateToken() method then i go and get the user from the DB. My ...
0
votes
1
answer
521
views
Facing Issue With HttpStatus in spring boot 3
Currently i am working on a project to upgrade it to spring boot 3 ,spring 6.x , java 17 .BUt i am facing an issue with "HttpStatus".I have a method which returns "HttpStatus.NO_CONTENT&...
0
votes
1
answer
198
views
How to set a response status for a nuxt page? 404
I want to set response status 404 on my /not-found page.
I tried to:
create custom error page in ~/error.vue and throw fatal errors with createError. But it just sends 200
throw fatal errors and use ...
0
votes
2
answers
361
views
Getting content-type from a request (httpRequestData) in Azure Function
I need to verify if the content coming into my Azure http function is not empty and is of type JSON.
So I am doing this within my Azure function:
if (req.Body.Length == 0)
{
...
0
votes
1
answer
29
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 ...
0
votes
0
answers
10
views
Status Code 0 error for api call between 2 app registration within same tenant in azure
I have a api call from one app registration to another in one of my project
i was able to successfully call the api in pre-prod
but in prod it's showing status 0 as response
http status code 0 is very ...
0
votes
0
answers
70
views
port 443: Connection refused in R on personal computer
I am following an API tutorial:
https://www.dataquest.io/blog/r-api-tutorial/
and step 1 - I attempted a GET request
res = GET("https://api.open-notify.org/astros.json")
I immediately hit a ...
1
vote
1
answer
40
views
Continue python script even if urllib.request encounters HTTP error codes
I have a python script that accepts a CSV file containing a list of URLs. The CSV file looks like this.
name, url
google, https://httpstat.us/200
yahoo, https://httpstat.us/401
bcs, https://httpstat....
2
votes
1
answer
40
views
Why isn't it recommended to use bare HTTP status codes in a response?
According to the documentation for Django REST Framework, "using bare status codes in your responses isn't recommended". They recommend instead using the objects from the status module (e.g. ...
0
votes
1
answer
23
views
Asynchronous API - POST & GET - multiple GET endpoints
I am building an Asynchronous API with polling and it has the following endpoints -
POST Create Resource
Request -
curl -X POST https://api.example.com/v1/card/eligibility/
Response -
{
"...
4
votes
4
answers
581
views
Correct HTTP status code for a resource not found
For example, I need to find User resource with the following address api/user/1.
In this case i am looking for exact resource with ID 1 and if resource does not exist, then 404 should be returned.
But ...
0
votes
0
answers
36
views
Express response status 400 change to 503
I'm using Express, and I want to send response status code 400. The morgan says that I responsed with status 400, but I get 503 in browser.
router.get('/counselor/field', async (req, res, next) => {...
0
votes
0
answers
25
views
Handling StatusCodes when Entities which do not exist but are not part of the resource either?
Lets say i have a Book API with following endpoint:
PUT /api/Book/{bookId}/Author/{authorId}/?userId={userId}
(the userId is the User who adds/removes the author from the book)
Which status codes ...
0
votes
1
answer
46
views
If I add the "-f" parameter to CURL, how can I display the response body when the status code is not 200?
I am using curl to make a http request, and I need it to report an error(return not zero) when returning an abnormal status code, so I added the "-f" parameter. But this way, the content of ...
0
votes
1
answer
63
views
Why should I use Rails HTTP status symbols instead of codes? Or, why not?
E.g. :ok over 200 (or viceversa) for HTTP responses.
Advantages and disadvantages, pros and cons, etc. of using symbols instead of codes (or viceversa) are welcome.
0
votes
0
answers
21
views
GetResponse -- returns response.Status strings instead of HttpStatusCodes
I coded up a Restsharp call to Bitly's APIs and it worked. I received back the numbered HTTP StatusCode in the 200, 300, 400, and 500 ranges.
Now that switched over to using the BitlyAPI Nuget ...
0
votes
0
answers
139
views
C# Downloading files from Google Cloud and facing this error (HttpStatusCode is not found. Newtonsoft.Json.JsonReaderException)
I have been trying to upload and download files to and from google cloud .
public static class Program
{
public static void Main(string[] args)
{
...
0
votes
1
answer
569
views
HTTP Status code for partial success or partial error response
I have an application where we send a request to two applications parallelly. Once I receive both the responses, I consolidate them to form a final response. When one of the systems fails to send a ...
0
votes
0
answers
363
views
The type HttpStatus does not define isError(HttpStatusCode) defined here in java 17
I am trying to upgrade my existing code to java 17 , but I am getting an error while trying to return the bearer token response. The onStatus method is giving compilation error but it was working ...
0
votes
0
answers
3k
views
What could be causing "SSLError: EOF occurred in violation of protocol" when using requests.get() to access YouTube videos in python?
I am very new to programming and the computer world in general. I am trying to send a request to www.youtube.com using the requests module. When I type its address in my browser, everything works just ...
-1
votes
2
answers
76
views
Which HTTP code is most suitable for when an endpoint is "full"?
If you have an endpoint that only a limited number of connections can be open to (think a video call, or a queue for a ticketing site), what's the best HTTP Code to signal to a Client that the ...
2
votes
1
answer
116
views
What would be the proper HTTP Status code when user exceeds daily transfer limit?
Each user has daily credit limit.
If user exceeds their daily limit what HTTP status code would be right here.
403 -Forbidden or 200 -Success (with validation Result)
0
votes
1
answer
227
views
What would be the proper backend response for 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 ...
0
votes
0
answers
26
views
What are the appropriate status codes returned from a GET endpoint that depends on a downstream API POST endpoint?
I am working on a frontend app which calls a GET endpoint of an API I an developing. This API calls a downstream API POST endpoint to handle the request for the GET endpoint. This downstream API POST ...
0
votes
0
answers
17
views
Error catch all in startup class does not return a 404 header
In my Startup class I have the following code:-
app.Use(async (context, next) =>
{
await next();
var originalPath = context.Request.Path.Value;
context.Items["originalPath"] = ...
1
vote
1
answer
69
views
Why is the client receiving a different status_code than the sent one?
I have this endpoint in my API which calls another endpoint in another API. I'm just returning the received response to the client, but sometimes the client is actually receiving a different ...
0
votes
0
answers
105
views
How to check if a Cloudflare Turnstile protected website exists?
I would like to check the status code of a website. I was using a simple HEAD request for this purpose until now, but the website now implemented Cloudflare Turnstile so my code broke.
Here is what I ...
0
votes
1
answer
274
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 ...
1
vote
1
answer
176
views
Powershell webrequest handle response code and exit
I want it to exit when the response status code is 429, how can I do it? my looped ps1 script
I don't want to use do or try or catch methods. Is there a simple method? this is my code and i want it to ...
-3
votes
1
answer
105
views
What is the correct error code for timeout?
I am developing a website and it will display a page for 5 minutes and user will be redirected to an error page which ask them to refresh the page. What status code should I put in the error page?
I ...
0
votes
1
answer
23
views
Which status code to use after deep pagination limit
We have an API and we want to reject requests beyond page 99.
EG:
GET example.com/users?page[number]=99 # Allowed, returns 200 OK
GET example.com/users?page[number]=100 # Disallowed, returns ???
What ...
0
votes
0
answers
55
views
@ResponseStatus annotation custom error status code
Is that any kind of scenario when I want to catch global exceptions @ResponseStatus(MyCustomHttpStatus.PASSWORD_NOT_MATCED) for example. and I want to send @ResponseStatus annotation my own custom ...
1
vote
3
answers
917
views
What is the correct status code, if my server can't reach a third party server?
I have a server, which does a request to AWS S3.
What is the correct status code, if my server's request to S3 failed?
Let me break it down more.
"Client" does request to "my server&...
0
votes
1
answer
180
views
Is there a way to override or change php/laravel request validate status code?
As you all may know, when we use laravel validate() function, the error status code it throws is 422. Is there a way to override or change the status code to 400?
$request->validate([ 'title' => ...
-1
votes
1
answer
37
views
http API Calling handle status code common function
Just cast it to
override fun httpErrorHandle(e: Throwable) {
val error = e as ANError
errorMessage(activity!!, error)
}
1
vote
1
answer
41
views
Does incorrectly returning an HTTP status code break the protocol?
For instance, if a request failed due to no authorization, clients expect a 401. However, if a server returns a 200 but with a message indicating failure to authenticate, does this technically go ...