UNPKG

cassava

Version:
229 lines (228 loc) 8.45 kB
/** * Standard HTTP status codes. * @see <a href="https://tools.ietf.org/html/rfc4918">https://tools.ietf.org/html/rfc4918</a> * @see <a href="https://tools.ietf.org/html/rfc7231">https://tools.ietf.org/html/rfc7231</a> */ export declare const httpStatusCode: { /** * Status codes for successful responses. */ success: { /** * The request has succeeded. The payload depends on the request method. * * GET a representation of the target resource, * * HEAD the same representation as GET, but without the representation * data, * * POST a representation of the status of, or results obtained from, * the action, * * PUT, DELETE a representation of the status of the action, * * OPTIONS a representation of the communications options, * * TRACE a representation of the request message as received by the end * server. */ OK: number; /** * The request has been fulfilled and has resulted in one or more new * resources being created. */ CREATED: number; /** * The request has been accepted for processing, but the processing has * not been completed. The primary resource created by the request is * identified by either a Location header field in the response or, if * no Location field is received, by the effective request URI. */ ACCEPTED: number; /** * The request was successful but the enclosed payload has been modified * from that of the origin server's 200 (OK) response by a transforming * proxy. */ NON_AUTHORITATIVE_INFORMATION: number; /** * The server has successfully fulfilled the request and there is no * content to send in the response payload body. */ NO_CONTENT: number; /** * The server has fulfilled the request and desires that the user agent * reset the "document view", which caused the request to be sent, to * its original state as received from the origin server. */ RESET_CONTENT: number; }; /** * Status codes for redirect. Pay special attention to which one is used * because they have subtle differences in browser and search engine behavior. */ redirect: { /** * The target resource has more than one representation, each with its own * more specific identifier, and information about the alternatives is being * provided so that the user (or user agent) can select a preferred * representation by redirecting its request to one or more of those * identifiers. */ MULTIPLE_CHOICES: number; /** * The resource moved permanently. Browsers will change POST to GET * on redirect. Search engines will update their index. * * Include a Location header field in the response. */ MOVED_PERMANENTLY: number; /** * The resource moved temporarily. Browsers will change POST to GET * on redirect. Search engines will *not* update their index. * * Include a Location header field in the response. */ FOUND: number; /** * The server is redirecting the user agent to a different resource, as * indicated by a URI in the Location header field, which is intended to * provide an indirect response to the original request. */ SEE_OTHER: number; /** * Cache hit. No content is sent. This is determined by the request * headers If-Modified-Since or If-None-Match. */ NOT_MODIFIED: number; /** * The resource moved temporarily and browsers should resubmit, * preserving the method and body. Don't use for GET. * Search engines will update their index. * * Include a Location header field in the response. */ TEMPORARY_REDIRECT: number; /** * The resource moved permanently and browsers should resubmit, * preserving the method and body. Don't use for GET. * Search engines will *not* update their index. * * Include a Location header field in the response. */ PERMANENT_REDIRECT: number; }; /** * The client screwed up. */ clientError: { /** * The request could not be understood by the server due to malformed * syntax. The client SHOULD NOT repeat the request without modifications. * For example the JSON body could not be parsed. */ BAD_REQUEST: number; /** * Authentication is required and the user is not logged in. */ UNAUTHORIZED: number; /** * The user is authenticated but does not have permission. */ FORBIDDEN: number; /** * The requested resource was not found. */ NOT_FOUND: number; /** * The resource does not support the given method. * The origin server MUST generate an Allow header field * containing a list of the supported methods. */ METHOD_NOT_ALLOWED: number; /** * The target resource does not have a current representation that would * be acceptable to the user agent, according to the proactive negotiation * header fields received in the request. */ NOT_ACCEPTABLE: number; /** * The request was understood, and semantically correct, but conflicts * with the current state. For example: the type is locked. */ CONFLICT: number; /** * Access to the target resource is no longer available at the origin server * and this condition is likely to be permanent. * * The 410 response is primarily intended to assist the task of web * maintenance by notifying the recipient that the resource is * intentionally unavailable and that the server owners desire that * remote links to that resource be removed. */ GONE: number; /** * The server refuses to accept the request without a defined Content-Length. */ LENGTH_REQUIRED: number; /** * The request is larger than the server is willing or able to process. */ PAYLOAD_TOO_LARGE: number; /** * The request type has a media type which the server or resource * does not support. */ UNSUPPORTED_MEDIA_TYPE: number; /** * The client has asked for a portion of the file (byte serving), but * the server cannot supply that portion. */ REQUESTED_RANGE_NOT_SATISFIABLE: number; /** * The expectation given in the request's Expect header field could not * be met. */ EXPECTATION_FAILED: number; /** * The request is syntactically correct, but contains semantic errors. * For example a string was expected but got a number. * @see <a href="https://tools.ietf.org/html/rfc4918#section-11.2">https://tools.ietf.org/html/rfc4918#section-11.2</a> */ UNPROCESSABLE_ENTITY: number; /** * The user has sent too many requests in a given amount of time. */ TOO_MANY_REQUESTS: number; }; /** * The server screwed up. */ serverError: { /** * Generic server-side error. */ INTERNAL_SERVER_ERROR: number; /** * Usually implies future availability. */ NOT_IMPLEMENTED: number; /** * Received an invalid response from an inbound server it accessed while * acting as a proxy. */ BAD_GATEWAY: number; /** * A service is temporarily down. */ SERVICE_UNAVAILABLE: number; /** * Did not receive a timely response from an upstream server while acting * as a proxy. */ GATEWAY_TIMEOUT: number; }; }; export declare const httpStatusString: { [statusCode: number]: string; };