├── .editorconfig ├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ └── test.yml ├── .gitignore ├── browser.js ├── build.js ├── index.js ├── license ├── package.json ├── readme.md └── test.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: "13:00" 8 | open-pull-requests-limit: 10 9 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: tests 2 | on: [push] 3 | jobs: 4 | build: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v2 8 | - name: Setup Node.js 9 | uses: actions/setup-node@v1 10 | with: 11 | node-version: '14' 12 | - run: npm install 13 | - run: npm test 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /browser.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "100": "Continue", 3 | "101": "Switching Protocols", 4 | "102": "Processing", 5 | "103": "Early Hints", 6 | "200": "OK", 7 | "201": "Created", 8 | "202": "Accepted", 9 | "203": "Non-Authoritative Information", 10 | "204": "No Content", 11 | "205": "Reset Content", 12 | "206": "Partial Content", 13 | "207": "Multi-Status", 14 | "208": "Already Reported", 15 | "226": "IM Used", 16 | "300": "Multiple Choices", 17 | "301": "Moved Permanently", 18 | "302": "Found", 19 | "303": "See Other", 20 | "304": "Not Modified", 21 | "305": "Use Proxy", 22 | "307": "Temporary Redirect", 23 | "308": "Permanent Redirect", 24 | "400": "Bad Request", 25 | "401": "Unauthorized", 26 | "402": "Payment Required", 27 | "403": "Forbidden", 28 | "404": "Not Found", 29 | "405": "Method Not Allowed", 30 | "406": "Not Acceptable", 31 | "407": "Proxy Authentication Required", 32 | "408": "Request Timeout", 33 | "409": "Conflict", 34 | "410": "Gone", 35 | "411": "Length Required", 36 | "412": "Precondition Failed", 37 | "413": "Payload Too Large", 38 | "414": "URI Too Long", 39 | "415": "Unsupported Media Type", 40 | "416": "Range Not Satisfiable", 41 | "417": "Expectation Failed", 42 | "418": "I'm a Teapot", 43 | "421": "Misdirected Request", 44 | "422": "Unprocessable Entity", 45 | "423": "Locked", 46 | "424": "Failed Dependency", 47 | "425": "Too Early", 48 | "426": "Upgrade Required", 49 | "428": "Precondition Required", 50 | "429": "Too Many Requests", 51 | "431": "Request Header Fields Too Large", 52 | "451": "Unavailable For Legal Reasons", 53 | "500": "Internal Server Error", 54 | "501": "Not Implemented", 55 | "502": "Bad Gateway", 56 | "503": "Service Unavailable", 57 | "504": "Gateway Timeout", 58 | "505": "HTTP Version Not Supported", 59 | "506": "Variant Also Negotiates", 60 | "507": "Insufficient Storage", 61 | "508": "Loop Detected", 62 | "509": "Bandwidth Limit Exceeded", 63 | "510": "Not Extended", 64 | "511": "Network Authentication Required" 65 | } 66 | -------------------------------------------------------------------------------- /build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const fs = require('fs') 4 | const statusCodes = require('./') 5 | 6 | const code = 'module.exports = ' + JSON.stringify(statusCodes, null, 2) + '\n' 7 | 8 | fs.writeFileSync('browser.js', code) 9 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = require('http').STATUS_CODES 4 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Ben Drucker (bendrucker.me) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "builtin-status-codes", 3 | "main": "index.js", 4 | "browser": "browser.js", 5 | "version": "3.0.0", 6 | "description": "The map of HTTP status codes from the builtin http module", 7 | "license": "MIT", 8 | "repository": "bendrucker/builtin-status-codes", 9 | "author": { 10 | "name": "Ben Drucker", 11 | "email": "bvdrucker@gmail.com", 12 | "url": "bendrucker.me" 13 | }, 14 | "scripts": { 15 | "test": "standard && tape test.js", 16 | "build": "node build.js" 17 | }, 18 | "keywords": [ 19 | "http", 20 | "status", 21 | "codes", 22 | "builtin", 23 | "map" 24 | ], 25 | "devDependencies": { 26 | "tape": "^5.0.0", 27 | "standard": "^17.0.0" 28 | }, 29 | "files": [ 30 | "index.js", 31 | "browser.js", 32 | "build.js" 33 | ], 34 | "standard": { 35 | "ignore": [ 36 | "browser.js" 37 | ] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # builtin-status-codes [![tests](https://github.com/bendrucker/builtin-status-codes/workflows/tests/badge.svg)](https://github.com/bendrucker/builtin-status-codes/actions?query=workflow%3Atests) 2 | 3 | > The map of HTTP status codes from the builtin http module. Exposes the latest directly from `http` in Node, with a zero-dependencies version for the browser. 4 | 5 | ## Install 6 | 7 | ``` 8 | npm install --save builtin-status-codes 9 | ``` 10 | 11 | ## Usage 12 | 13 | ```js 14 | const codes = require('builtin-status-codes') 15 | codes[100] 16 | //=> Continue 17 | ``` 18 | 19 | ## Build 20 | 21 | To create a new browser build: 22 | 23 | ```sh 24 | npm run build 25 | ``` 26 | 27 | ## License 28 | 29 | MIT © [Ben Drucker](http://bendrucker.me) 30 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const test = require('tape') 4 | const node = require('./') 5 | const browser = require('./browser') 6 | 7 | test(function (t) { 8 | t.equal(node[100], 'Continue') 9 | t.equal(node[100], browser[100]) 10 | t.end() 11 | }) 12 | --------------------------------------------------------------------------------