ChemPal Documentation - v1.17.0
    Preparing search index...

    Enumeration HttpStatus

    Common HTTP status codes, named in UPPER_SNAKE_CASE after their reason phrases.

    if (response.status === HttpStatus.OK) return parse(response);
    if (response.status === HttpStatus.TOO_MANY_REQUESTS) await backOff();
    HttpStatus.NOT_FOUND; // => 404
    export enum HttpStatus {
    // 2xx: success
    /** The request succeeded. */
    OK = 200,
    /** The request succeeded and created a resource. */
    CREATED = 201,
    /** The request was accepted for processing, which may not have finished. */
    ACCEPTED = 202,
    /** The request succeeded and there is no body to return. */
    NO_CONTENT = 204,
    /** Only part of the resource was returned, as a range request asked for. */
    PARTIAL_CONTENT = 206,

    // 3xx: redirection
    /** The resource has permanently moved. */
    MOVED_PERMANENTLY = 301,
    /** The resource is temporarily at another URL. */
    FOUND = 302,
    /** The response lives at another URL and should be fetched with GET. */
    SEE_OTHER = 303,
    /** The cached copy is still valid. */
    NOT_MODIFIED = 304,
    /** Temporary redirect that keeps the request method. */
    TEMPORARY_REDIRECT = 307,
    /** Permanent redirect that keeps the request method. */
    PERMANENT_REDIRECT = 308,

    // 4xx: client error
    /** The server could not understand the request. */
    BAD_REQUEST = 400,
    /** Authentication is required or has failed. */
    UNAUTHORIZED = 401,
    /** Reserved for payment; some storefronts use it for paywalled content. */
    PAYMENT_REQUIRED = 402,
    /** The server understood the request but refuses it (often a bot challenge). */
    FORBIDDEN = 403,
    /** The resource does not exist. */
    NOT_FOUND = 404,
    /** The request method is not allowed for this resource. */
    METHOD_NOT_ALLOWED = 405,
    /** The server cannot produce a response matching the `Accept` headers. */
    NOT_ACCEPTABLE = 406,
    /** The server timed out waiting for the request. */
    REQUEST_TIMEOUT = 408,
    /** The request conflicts with the current state of the resource. */
    CONFLICT = 409,
    /** The resource is gone and will not return. */
    GONE = 410,
    /** The request body is larger than the server allows. */
    PAYLOAD_TOO_LARGE = 413,
    /** The request body's media type is not supported. */
    UNSUPPORTED_MEDIA_TYPE = 415,
    /** The request was well-formed but could not be processed. */
    UNPROCESSABLE_ENTITY = 422,
    /** Too many requests were sent; the client is being rate limited. */
    TOO_MANY_REQUESTS = 429,
    /** The resource is unavailable for legal reasons. */
    UNAVAILABLE_FOR_LEGAL_REASONS = 451,

    // 5xx: server error
    /** The server hit an unexpected error. */
    INTERNAL_SERVER_ERROR = 500,
    /** The server does not support the requested functionality. */
    NOT_IMPLEMENTED = 501,
    /** A gateway or proxy got an invalid response from upstream. */
    BAD_GATEWAY = 502,
    /** The server is overloaded or down for maintenance. */
    SERVICE_UNAVAILABLE = 503,
    /** A gateway or proxy timed out waiting for upstream. */
    GATEWAY_TIMEOUT = 504,
    }
    Index

    Enumeration Members

    OK: 200

    The request succeeded.

    CREATED: 201

    The request succeeded and created a resource.

    ACCEPTED: 202

    The request was accepted for processing, which may not have finished.

    NO_CONTENT: 204

    The request succeeded and there is no body to return.

    PARTIAL_CONTENT: 206

    Only part of the resource was returned, as a range request asked for.

    MOVED_PERMANENTLY: 301

    The resource has permanently moved.

    FOUND: 302

    The resource is temporarily at another URL.

    SEE_OTHER: 303

    The response lives at another URL and should be fetched with GET.

    NOT_MODIFIED: 304

    The cached copy is still valid.

    TEMPORARY_REDIRECT: 307

    Temporary redirect that keeps the request method.

    PERMANENT_REDIRECT: 308

    Permanent redirect that keeps the request method.

    BAD_REQUEST: 400

    The server could not understand the request.

    UNAUTHORIZED: 401

    Authentication is required or has failed.

    PAYMENT_REQUIRED: 402

    Reserved for payment; some storefronts use it for paywalled content.

    FORBIDDEN: 403

    The server understood the request but refuses it (often a bot challenge).

    NOT_FOUND: 404

    The resource does not exist.

    METHOD_NOT_ALLOWED: 405

    The request method is not allowed for this resource.

    NOT_ACCEPTABLE: 406

    The server cannot produce a response matching the Accept headers.

    REQUEST_TIMEOUT: 408

    The server timed out waiting for the request.

    CONFLICT: 409

    The request conflicts with the current state of the resource.

    GONE: 410

    The resource is gone and will not return.

    PAYLOAD_TOO_LARGE: 413

    The request body is larger than the server allows.

    UNSUPPORTED_MEDIA_TYPE: 415

    The request body's media type is not supported.

    UNPROCESSABLE_ENTITY: 422

    The request was well-formed but could not be processed.

    TOO_MANY_REQUESTS: 429

    Too many requests were sent; the client is being rate limited.

    UNAVAILABLE_FOR_LEGAL_REASONS: 451

    The resource is unavailable for legal reasons.

    INTERNAL_SERVER_ERROR: 500

    The server hit an unexpected error.

    NOT_IMPLEMENTED: 501

    The server does not support the requested functionality.

    BAD_GATEWAY: 502

    A gateway or proxy got an invalid response from upstream.

    SERVICE_UNAVAILABLE: 503

    The server is overloaded or down for maintenance.

    GATEWAY_TIMEOUT: 504

    A gateway or proxy timed out waiting for upstream.