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.

For a full list of the status codes see the HTTP 1.1 specification, WebDAV specification, RFC 6585, and the IANA list of status codes.

HTTP status codes have specific meanings which are outlined in the specification that they were created in. They can be used in contexts outside of what the specification states, but must adhere to any conditions that have been established in the specification.

1693 questions
47
votes
3 answers

How do I use Fiddler to modify the status code in an HTTP response?

I need to test some client application code I've written to test its' handling of various status codes returned in an HTTP response from a web server. I have Fiddler 2 (Web Debugging Proxy) installed and I believe there's a way to modify responses…
w5m
  • 2,286
  • 3
  • 34
  • 46
47
votes
7 answers

Get status code http.get response angular2

I need to get the status code of the following http call and return it as a string //This method must return the status of the http response confirmEmail(mailToken):Observable{ return…
46
votes
3 answers

System.Net HttpStatusCode class does not have code 422

Is there a way to handle http status code 422 gracefully. I am looking for the best practice here. I know that HttpStatusCode is an enum so what i tried is this, HttpStatusCode Unprocessable = (HttpStatusCode)422; if (Response ==…
golldy
  • 1,279
  • 1
  • 15
  • 31
46
votes
6 answers

Laravel, how to redirect as 301 and 302

I cannot find info for redirecting as 301/302 in the Laravel docs. In my routes.php file I use: Route::get('foo', function(){ return Redirect::to('/bar'); }); Is this a 301 or 302 by default? Is there a way to set it manually? Any idea why…
Justin
  • 26,443
  • 16
  • 111
  • 128
45
votes
8 answers

Http Status Code in Android Volley when error.networkResponse is null

I am using Google Volley on the Android platform. I am having a problem in which the error parameter in onErrorResponse is returning a null networkResponse For the RESTful API I am using, I need to determine the Http Status Code which is often…
David Manpearl
  • 12,362
  • 8
  • 55
  • 72
44
votes
5 answers

3rd party API gives back 500 error, what code should my API return

I've written an API in a framework based on ZF2 (Zend Framework 2) called Apigility. My Service can query 3rd party API's. Once in a while, I get back a 500 error message.. either due to expired tokens, or some such. How should MY API respond back…
Erik
  • 2,782
  • 3
  • 34
  • 64
43
votes
3 answers

Return Mvc.JsonResult plus set Response.StatusCode

Project: ASP MVC 4 running under .net 4.0 framework: When running an application under VS 2010 express (or deployed and running under IIS 7.5 on my local machine) the following (pseudocode) result from an action works as expected [HttpPost] public…
Brent
  • 4,611
  • 4
  • 38
  • 55
43
votes
3 answers

HTTP status code for bad data

What HTTP status code should I return when a client posts bad data (e.g. a string when integer was expected)? I've been using 400 Bad Request, but as I read over the HTTP docs that seems more applicable to HTTP protocol errors. I'd like to use a…
Ben K.
  • 1,779
  • 5
  • 18
  • 21
42
votes
2 answers

Authorization in RESTful HTTP API, 401 WWW-Authenticate

I'm creating a RESTful service to provide data to a web application. I have two related questions about this. 1. How to deal with unauthorized requests? I'm intending to respond to requests with the following codes: Is the resource open and found?…
Aidiakapi
  • 6,034
  • 4
  • 33
  • 62
40
votes
3 answers

HTTP Status Code for Captcha

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 URI. I'm wondering now which HTTP status code…
40
votes
1 answer

Which HTTP status code to say username or password were incorrect?

I am implementing a simple registation/login module. While testing user credentials, I start thinking which HTTP status code will be appropriate, for the situation if a user send a request with incorrect credentials. At first, I thought 401…
Nodari Lipartiya
  • 1,148
  • 3
  • 14
  • 24
40
votes
2 answers

HTTP statuscode to retry same request

Is there an HTTP status code to instruct a client to perform the same request again? I am facing a situation where the server has to "wait" for a lock to disappear when processing a request. But by the time the lock disappears, the requests might…
Jeroen Ooms
  • 31,998
  • 35
  • 134
  • 207
38
votes
4 answers

Correct HTTP status code for login form?

I am implementing the authentication for an app, and I am using a pluggable system with "authentication methods". This allows me to implement both HTTP Basic as well as HTML-based authentication. With HTTP Basic/Digest auth the server sends a 401…
igorw
  • 27,759
  • 5
  • 78
  • 90
38
votes
5 answers

Spring: return @ResponseBody "ResponseEntity>"

In controller I create json array. If I return List it is ok: @RequestMapping(value="", method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE) public @ResponseBody List getAll() { List entityList =…
martin
  • 1,707
  • 6
  • 34
  • 62
38
votes
4 answers

Http Redirection code 3XX in python requests

I am trying to capture http status code 3XX/302 for a redirection url. But I cannot get it because it gives 200 status code. Here is the code: import requests r = requests.get('http://goo.gl/NZek5') print r.status_code I suppose this should issue…
Bishwash
  • 854
  • 1
  • 9
  • 22