Questions tagged [http-status]

The status code describes the state of the response from the web server.

Each Status-Code is described in the W3C HTTP 1.1 specifications, including a description of which method(s) it can follow and any metainformation required in the response.

78 questions
26
votes
3 answers

What is the suitable HTTP status code when request is successful but has warning messages?

In proper usage of REST, what is suitable the HTTP status code when request is successful but has warning messages? In our case; clients are web applications running on browsers. We prefer status codes as following: HTTP 200, 201, 204 when request…
ykaragol
  • 6,139
  • 3
  • 29
  • 56
23
votes
5 answers

How to get HTTP status message in (py)curl?

spending some time studying pycurl and libcurl documentation, i still can't find a (simple) way, how to get HTTP status message (reason-phrase) in pycurl. status code is easy: import pycurl import cStringIO curl = pycurl.Curl() buff =…
mykhal
  • 19,175
  • 11
  • 72
  • 80
22
votes
2 answers

A distinct HTTP status for not logged in vs. not authorized in a RESTful API

So send a few different status headers in my API including 404, 409, 201, 302 and the like. Now I'm running into issues with 401 Unauthorized. I'm currently sending it if a user is not logged in (the entire API is rights managed) or if a user…
Steven
  • 17,796
  • 13
  • 66
  • 118
19
votes
2 answers

HTTP 404 vs 400 for invalid query parameters

Here is my request URL: http://server.com/app/user/getuser/?userId=9999 Note that userId is query parameter. Not embedded path parameter. I understand that if the request URL is: http://server.com/app/user/getuser/9999 and the ID 9999 does not exist…
LHA
  • 9,398
  • 8
  • 46
  • 85
16
votes
1 answer

Retrieve REDIRECT_STATUS with error_page

Using .htaccess and ErrorDocument 404 /error.php, if access an invalid url eg.: http://example/css/invalid-file.css:
Protomen
  • 9,471
  • 9
  • 57
  • 124
10
votes
1 answer

HTTP status: 409 vs 428

From List of HTTP status code (Wikipedia) it says: 409 Conflict Indicates that the request could not be processed because of conflict in the request, such as an edit conflict between multiple simultaneous updates. And 428 Precondition Required (RFC…
Gelin Luo
  • 14,035
  • 27
  • 86
  • 139
7
votes
1 answer

Laravel Axios Failed with status code 419 using Vue

Concept: I have an application that allows users post a question... When the user clicks the Ask button i trying to submit the the quesiton using Vue.js and Axios. Problem: 70% of the time the question is submitted properly, but 30% of the time it…
Julian Tabona
  • 325
  • 3
  • 13
5
votes
1 answer

NestJS - Cannot set headers after they are sent to the client

In my NestJs project, I am using decorator @Res() res and using the response object to set custom response header status by multiple cases. When calling, sometimes it logs: Error [ERR_HTTP_HEADERS_SENT]: Cannot remove headers after they are sent to…
5
votes
1 answer

What http status code should I use when customer configuration is not correct?

I am unsure what http status code to return when a customer calls my API, but the requested action cannot be completed for reasons that the customer can fix. In this case, the http request itself may be fine, but it will not succeed until the…
Mike Kantor
  • 1,400
  • 4
  • 24
  • 45
5
votes
1 answer

Render status: 403 causes "Missing template" error

I have some method in before_filter and I try to render status: 403. then I get: Missing template v1/examples/index, v1/base/index, application/index with {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :vcf, :png, :jpeg, :gif,…
ciembor
  • 7,189
  • 13
  • 59
  • 100
5
votes
2 answers

HTTP status code when an object is not found with an id which is passed via request body

I will explain my doubt by throwing an example. Suppose i am designing an endpoint POST for student resource and as part of the POST endpoint i want a teacher uuid to be passed (apart from other details) which is a mandatory field. So that i can…
Trying
  • 14,004
  • 9
  • 70
  • 110
4
votes
2 answers

HTTP Response Status-Line maximum size

Quick question - is there a maximum size for the Status-Line of a HTTP Response? In the RFC I could not find this information, just something like this: Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF According to this i could…
Toby
  • 3,815
  • 14
  • 51
  • 67
4
votes
2 answers

PHP-FPM Always Returns 200 Regardless Of NGINX Status Code

I have a PHP-based error page configuration with NGINX and PHP-FPM. However, when I request, for example, example.com/nothing (non-existent page), PHP-FPM returns a 200 status code, and not the correct 404 status code that NGINX returns. This also…
Spotlightsrule
  • 128
  • 1
  • 9
4
votes
2 answers

What's the appropriate HTTP status code when the request is missing a required cookie?

I have an API endpoint and the request should have a cookie (not authentication). What would be the correct HTTP status code to return if it isn't present? I would assume a 400 Bad Request would be the best.
Timigen
  • 1,055
  • 1
  • 17
  • 33
4
votes
2 answers

Changing HTTP status message using Sinatra

I'm writing a simple Sinatra app, and given a user posts a request with an specific data, I want to return an error '453' (custom error code) with a message CLIENT_ERROR, or something similar. The problem is: looking into the Sinatra documentation…
RobisonSantos
  • 611
  • 6
  • 16
1
2 3 4 5 6