http-status-codes

What is the HTTP status code for License limit reached

本秂侑毒 提交于 2020-07-03 01:50:33
问题 I want to know what is the ideal HTTP status code an API should return when a user's license has reached? Initially I was thinking its 402 (Payment Required) but this is not my scenario. My case is if my user has a limit to add 10 plugins, if she tries to add the 11th plugin they should get an error that their limit has reached. Please help me with the appropriate HTTP status code for this. Thanks in advance 回答1: There's no HTTP status code for quota exceeded , however there are a few HTTP

HTTP Status Code from URL in Javascript

懵懂的女人 提交于 2020-05-27 12:39:32
问题 I'm trying to find a function that return HTTP Status Code from an URL, and then "make something" based on the returned statuses (404, 416, 200 etc...) Can someone help me? I've tried the other functions posted here on StackOverflow but anyone was usefull for my purpose. I need to integrate this function inside my PlayFramework web-app. Thanks a lot 回答1: Can you try the following ..? function getStatus(url) { var request = new XMLHttpRequest(); request.onreadystatechange = function() { if

HTTP status code handling in GraphQL APIs

一曲冷凌霜 提交于 2020-01-30 08:03:27
问题 A lot of resources say, that GraphQL should always respond with a 200 status code, even when an error occurred: https://www.graph.cool/docs/faq/api-eep0ugh1wa/#how-does-error-handling-work-with-graphcool https://github.com/rmosolgo/graphql-ruby/issues/1130#issuecomment-347373937 https://blog.hasura.io/handling-graphql-hasura-errors-with-react/ Because GraphQL can return multiple responses in one response, this makes sense. When a user requests two resources in one request, and only has access

Which HTTP response code to use when the request takes too long?

狂风中的少年 提交于 2020-01-30 02:39:10
问题 I'm building an API that does analytics on a very large database we are storing. Some requests take a very long time to process. We want to proactively abort requests that take more than 10 minutes, but we don't know if a request will take that long until we try it. Most of the time, it's not because of transient server overloading. It's that the user made a request involving so much data that we simply can't get through it fast enough. I've scoured the list of standard HTTP response codes

A http 204 response returns a blank page in iOS, is there a way to stop this?

余生颓废 提交于 2020-01-25 09:40:08
问题 This may have been asked before but I can't seem to find a solution, so apologies if this is the case. I have a simple node app in development which uses express. One of the post routes returns a http 204 and sends it, below is my code: router.post("/:id", function(req, res, next) { if (!req.session.userId) { res.status(204).send(); } else { console.log(req.params.id); User.findById(req.session.userId, function (err, user) { if (err) return handleError(err); const nameForDatabase = req.params

IIS 7.5: sending http status code 422 with custom errors on

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-21 10:45:28
问题 I use custom action filter in asp.net mvc app to return http status code 422 and json list of validation errors (basically serialized model state dictionary) to client, where I handle that with global ajaxError handler in jQuery. All of this works on development enviroment, but my problem is when custom errors mode is on ( <system.webServer>/<httpErrors errorMode="Custom"> ), IIS replaces response (json) with text "The custom error module does not recognize this error." I'm having hard time

IIS 7.5: sending http status code 422 with custom errors on

痞子三分冷 提交于 2020-01-21 10:45:07
问题 I use custom action filter in asp.net mvc app to return http status code 422 and json list of validation errors (basically serialized model state dictionary) to client, where I handle that with global ajaxError handler in jQuery. All of this works on development enviroment, but my problem is when custom errors mode is on ( <system.webServer>/<httpErrors errorMode="Custom"> ), IIS replaces response (json) with text "The custom error module does not recognize this error." I'm having hard time

How to check if a webpage exists. jQuery and/or PHP

假装没事ソ 提交于 2020-01-21 04:52:11
问题 I want to be able to validate a form to check if a website/webpage exists. If it returns a 404 error then that definitely shouldn't validate. If there is a redirect...I'm open to suggestions, sometimes redirects go to an error page or homepage, sometimes they go to the page you were looking for, so I don't know. Perhaps for a redirect there could be a special notice that suggests the destination address to the user. The best thing I found so far was like this: $.ajax({url: webpage ,type:'HEAD