json - How HTTP/1.1 401 Unauthorized should be in RESTful api? -


i studying restful api. have not clear how 401 countent must be. issue want complete json api. so, ... http/1.1 401 unauthorized in json must have content? kind of content?

actually return this:

< http/1.1 401 unauthorized < date: thu, 10 nov 2016 12:48:36 gmt < server: apache/2.4.23 (unix) php/5.6.24 < www-authenticate: basic realm="my protected area" < content-length: 381 < content-type: text/html; charset=iso-8859-1 < <!doctype html public "-//ietf//dtd html 2.0//en"> <html><head> <title>401 unauthorized</title> </head><body> <h1>unauthorized</h1> <p>this server not verify authorized access document requested.  either supplied wrong credentials (e.g., bad password), or browser doesn't understand how supply credentials required.</p> </body></html> 

next response correct? both correct?

< http/1.1 401 unauthorized < date: thu, 10 nov 2016 12:48:36 gmt < server: apache/2.4.23 (unix) php/5.6.24 < www-authenticate: basic realm="my protected area" < content-length: 381 < content-type: text/html; charset=iso-8859-1 < {"title":"401 unauthorized","message":"this server not verify authorized access document requested.  either supplied wrong credentials (e.g., bad password), or browser doesn't understand how supply credentials required."} 

is header 'accept' missing complete responds question?


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -