├── .github └── FUNDING.yml ├── .gitignore ├── .nvmrc ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── PULL_REQUEST_TEMPLATE.md ├── README.md ├── config ├── env.js ├── jest │ ├── cssTransform.js │ └── fileTransform.js ├── paths.js ├── webpack.config.dev.js ├── webpack.config.prod.js └── webpackDevServer.config.js ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html └── manifest.json ├── scripts ├── build.js ├── start.js └── test.js └── src ├── App.test.js ├── actions ├── actionTypes.js └── httpInfoAction.js ├── apis ├── data │ ├── codes │ │ ├── 1xx.json │ │ ├── 2xx.json │ │ ├── 3xx.json │ │ ├── 4xx.json │ │ ├── 5xx.json │ │ └── index.js │ ├── index.js │ ├── questions │ │ ├── codes │ │ │ ├── 1xx.json │ │ │ ├── 2xx.json │ │ │ ├── 3xx.json │ │ │ ├── 4xx.json │ │ │ ├── 5xx.json │ │ │ └── index.js │ │ └── httpSeriesCodeQuestions.json │ ├── series.json │ ├── sites.json │ └── stability.json └── httpInfoApi.js ├── components ├── common │ ├── contentHeader.js │ └── pageHeader.js ├── flow │ ├── httpCodeCardList.js │ ├── httpCodeInfoCard.js │ ├── httpSeriesCardList.js │ ├── httpSeriesCardMinimal.js │ └── questionComponent.js ├── layouts │ └── defaultLayout.js └── motion │ └── ScrollReveal │ ├── ScrollReveal.js │ └── index.js ├── constant ├── params.js └── routes.js ├── containers ├── FAQ.json ├── FAQContainer.js ├── analytics │ └── gaTrackingContainer.js ├── appContainer.js ├── creditsContainer.js ├── httpQuestionaire │ ├── httpStatusAnswerContainer.js │ ├── httpStatusCodeAnswerContainer.js │ └── httpStatusSeriesAnswerContainer.js ├── httpcodesListContainer.js └── resourceContainer.js ├── index.js ├── reducers ├── httpInfoReducer.js └── index.js ├── serviceWorker.js ├── static ├── css │ └── App.css └── img │ └── logo.svg └── store └── configureStore.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [anubhavsrivastava] 4 | patreon: theanubhav 5 | open_collective: onlyanubhav 6 | ko_fi: theanubhav 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ['https://donorbox.org/theanubhav', 'https://www.buymeacoffee.com/theanubhav','https://paypal.me/onlyanubhav', 'https://theanubhav.com/sponsor'] 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 63 | 64 | # dependencies 65 | /node_modules 66 | /.pnp 67 | .pnp.js 68 | 69 | # testing 70 | /coverage 71 | 72 | # production 73 | /build 74 | 75 | # misc 76 | .DS_Store 77 | .env.local 78 | .env.development.local 79 | .env.test.local 80 | .env.production.local 81 | 82 | npm-debug.log* 83 | yarn-debug.log* 84 | yarn-error.log* 85 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | v9.10.1 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '11.10.1' 4 | cache: 5 | directories: 6 | - node_modules 7 | before_install: 8 | - npm update 9 | install: 10 | - npm install 11 | script: 12 | - npm run coveralls 13 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at anubhav.srivastava00@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution Guidelines 2 | 3 | Please ensure your pull request follow these guidelines: 4 | 5 | - Search previous suggestions before making a new one, as yours may be a duplicate. 6 | - Make an individual pull request for each suggestion. Another way to suggest it opening an issue on this repository. 7 | - Keep descriptions short and simple, but descriptive. 8 | - Check your spelling and grammar. 9 | - Make sure your text editor is set to remove trailing whitespace and not change any other part of except for place you desire. 10 | 11 | Thank you for your contributions/suggestions! 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Anubhav Srivastava 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 all 13 | 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 THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Whats my HTTP Status Code - [Visit](https://httpstatuscode.netlify.com) 2 | 3 | A UI Based interface to guide you to exact web api - http specification status your server should return for any web request. 4 | 5 | [![Build Status](https://travis-ci.org/anubhavsrivastava/whats-my-http-statuscode.svg?branch=master)](https://travis-ci.org/anubhavsrivastava/whats-my-http-statuscode) 6 | [![Coverage Status](https://coveralls.io/repos/github/anubhavsrivastava/whats-my-http-statuscode/badge.svg?branch=master)](https://coveralls.io/github/anubhavsrivastava/whats-my-http-statuscode?branch=master) 7 | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) 8 | [![GitHub issues](https://img.shields.io/github/issues/anubhavsrivastava/whats-my-http-statuscode.svg?style=flat-square)](https://github.com/anubhavsrivastava/whats-my-http-statuscode/issues) 9 | [![HitCount](http://hits.dwyl.io/anubhavsrivastava/whats-my-http-statuscode.svg)](http://hits.dwyl.io/anubhavsrivastava/whats-my-http-statuscode) 10 | 11 | ## Introduction 12 | 13 | This projects helps you choose appropriate HTTP status code for your web APIs. Based on series of questions, it lets arrive to a appropriate HTTP status code (with reason). In short, it makes choosing HTTP code much easier. 14 | 15 | ## Concepts 16 | 17 | ### Usage 18 | 19 | Answer a series of question regarding your current implementation or problem that you have with the API, starting off with selection of HTTP code series, like 200 series (success) or 500 series (server error). Once you have correctly identified you HTTP status series, you can answer few more questions to get to exact HTTP status code. 20 | 21 | #### Why should any developer use it? 22 | 23 | There can be a confusion regarding what exact HTTP status code should be for a particular scenario, for eg, should it be `404 Not Found` or `204 No Content` in scenarios where resource exist but has no information. Or should one give `403 Forbidden` for access denied resource and let the user know about existence of the resource (security) or should say `404 Not Found`. 24 | 25 | #### For whom is this tool meant for? 26 | 27 | This is meant for Restful APIs and system that want to follow standard HTTP status code. One should consider following a specification for better usability across system, providing APIs to third party, disconnecting WEB API server with frontend to understand API response, or simply move ahead with just `200 OK` status across the system with actual reason in body `{ "status": "failure" }` 28 | 29 | ## Inspiration 30 | 31 | Inspired by the awesome work on HTTP status code selection by [Michael Kropat - Codetinkerer.com](https://www.codetinkerer.com/2015/12/04/choosing-an-http-status-code.html) 32 | 33 | ## Development 34 | 35 | To add more features or fix a thing or two, to this project, you need to make sure you have all the requirements checked, this project installed, and a little understanding of this project. 36 | 37 | ### Requirement 38 | 39 | You need to be at least familiar with the following tools and languages: 40 | 41 | - HTML/CSS 3/JavaScript 42 | - React/Redux/React-Router 43 | - JSON 44 | 45 | ### Installation 46 | 47 | You can now install the project and start developing. To do so, just follow these steps: 48 | 49 | - Fork this project. 50 | - Clone your fork git clone 51 | - Branch out git branch -b NEW-BRANCH 52 | - Make your changes. 53 | - Create a pull request. 54 | 55 | To run this project locally, perform following steps 56 | 57 | - Install packages via `npm install` or `yarn` , this will install all the dependencies required by the project 58 | - To start development on local machine, run `npm start` on terminal. 59 | 60 | P.S This project is created from ejected `create-react-app`. 61 | 62 | ## Contribution 63 | 64 | One can contribute to this project in following ways, 65 | 66 | ### Development 67 | 68 | This project can be improved so much more, with new features and design. Code refactoring is also welcomed. If you are willing and interested, feel free to help develop it for yourself and others. 69 | 70 | ### Report issues and help improve 71 | 72 | If you feel a feature is missing, or you have encounter a bug, report it in the issues section. Even if you feel question/flow are leading to wrong interpretation, feel free to open a issue. 73 | Please read the [contribution guidelines](CONTRIBUTING.md) to get started. 74 | 75 | ### Spread the words 76 | 77 | ⭐️ Star this project, use it, or share it with your friends. It will really help us to gain motivation and zeal towards working on it. 78 | 79 | ## License 80 | 81 | [![Open Source Love](https://badges.frapsoft.com/os/mit/mit.svg?v=102)](LICENSE) 82 | 83 | Refer [LICENSE](LICENSE) file in this repository. 84 | -------------------------------------------------------------------------------- /config/env.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const fs = require('fs'); 4 | const path = require('path'); 5 | const paths = require('./paths'); 6 | 7 | // Make sure that including paths.js after env.js will read .env variables. 8 | delete require.cache[require.resolve('./paths')]; 9 | 10 | const NODE_ENV = process.env.NODE_ENV; 11 | if (!NODE_ENV) { 12 | throw new Error( 13 | 'The NODE_ENV environment variable is required but was not specified.' 14 | ); 15 | } 16 | 17 | // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use 18 | var dotenvFiles = [ 19 | `${paths.dotenv}.${NODE_ENV}.local`, 20 | `${paths.dotenv}.${NODE_ENV}`, 21 | // Don't include `.env.local` for `test` environment 22 | // since normally you expect tests to produce the same 23 | // results for everyone 24 | NODE_ENV !== 'test' && `${paths.dotenv}.local`, 25 | paths.dotenv, 26 | ].filter(Boolean); 27 | 28 | // Load environment variables from .env* files. Suppress warnings using silent 29 | // if this file is missing. dotenv will never modify any environment variables 30 | // that have already been set. Variable expansion is supported in .env files. 31 | // https://github.com/motdotla/dotenv 32 | // https://github.com/motdotla/dotenv-expand 33 | dotenvFiles.forEach(dotenvFile => { 34 | if (fs.existsSync(dotenvFile)) { 35 | require('dotenv-expand')( 36 | require('dotenv').config({ 37 | path: dotenvFile, 38 | }) 39 | ); 40 | } 41 | }); 42 | 43 | // We support resolving modules according to `NODE_PATH`. 44 | // This lets you use absolute paths in imports inside large monorepos: 45 | // https://github.com/facebook/create-react-app/issues/253. 46 | // It works similar to `NODE_PATH` in Node itself: 47 | // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders 48 | // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored. 49 | // Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims. 50 | // https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421 51 | // We also resolve them to make sure all tools using them work consistently. 52 | const appDirectory = fs.realpathSync(process.cwd()); 53 | process.env.NODE_PATH = (process.env.NODE_PATH || '') 54 | .split(path.delimiter) 55 | .filter(folder => folder && !path.isAbsolute(folder)) 56 | .map(folder => path.resolve(appDirectory, folder)) 57 | .join(path.delimiter); 58 | 59 | // Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be 60 | // injected into the application via DefinePlugin in Webpack configuration. 61 | const REACT_APP = /^REACT_APP_/i; 62 | 63 | function getClientEnvironment(publicUrl) { 64 | const raw = Object.keys(process.env) 65 | .filter(key => REACT_APP.test(key)) 66 | .reduce( 67 | (env, key) => { 68 | env[key] = process.env[key]; 69 | return env; 70 | }, 71 | { 72 | // Useful for determining whether we’re running in production mode. 73 | // Most importantly, it switches React into the correct mode. 74 | NODE_ENV: process.env.NODE_ENV || 'development', 75 | // Useful for resolving the correct path to static assets in `public`. 76 | // For example, . 77 | // This should only be used as an escape hatch. Normally you would put 78 | // images into the `src` and `import` them in code to get their paths. 79 | PUBLIC_URL: publicUrl, 80 | } 81 | ); 82 | // Stringify all values so we can feed into Webpack DefinePlugin 83 | const stringified = { 84 | 'process.env': Object.keys(raw).reduce((env, key) => { 85 | env[key] = JSON.stringify(raw[key]); 86 | return env; 87 | }, {}), 88 | }; 89 | 90 | return { raw, stringified }; 91 | } 92 | 93 | module.exports = getClientEnvironment; 94 | -------------------------------------------------------------------------------- /config/jest/cssTransform.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // This is a custom Jest transformer turning style imports into empty objects. 4 | // http://facebook.github.io/jest/docs/en/webpack.html 5 | 6 | module.exports = { 7 | process() { 8 | return 'module.exports = {};'; 9 | }, 10 | getCacheKey() { 11 | // The output is always the same. 12 | return 'cssTransform'; 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /config/jest/fileTransform.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | 5 | // This is a custom Jest transformer turning file imports into filenames. 6 | // http://facebook.github.io/jest/docs/en/webpack.html 7 | 8 | module.exports = { 9 | process(src, filename) { 10 | const assetFilename = JSON.stringify(path.basename(filename)); 11 | 12 | if (filename.match(/\.svg$/)) { 13 | return `module.exports = { 14 | __esModule: true, 15 | default: ${assetFilename}, 16 | ReactComponent: (props) => ({ 17 | $$typeof: Symbol.for('react.element'), 18 | type: 'svg', 19 | ref: null, 20 | key: null, 21 | props: Object.assign({}, props, { 22 | children: ${assetFilename} 23 | }) 24 | }), 25 | };`; 26 | } 27 | 28 | return `module.exports = ${assetFilename};`; 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /config/paths.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | const url = require('url'); 6 | 7 | // Make sure any symlinks in the project folder are resolved: 8 | // https://github.com/facebook/create-react-app/issues/637 9 | const appDirectory = fs.realpathSync(process.cwd()); 10 | const resolveApp = relativePath => path.resolve(appDirectory, relativePath); 11 | 12 | const envPublicUrl = process.env.PUBLIC_URL; 13 | 14 | function ensureSlash(inputPath, needsSlash) { 15 | const hasSlash = inputPath.endsWith('/'); 16 | if (hasSlash && !needsSlash) { 17 | return inputPath.substr(0, inputPath.length - 1); 18 | } else if (!hasSlash && needsSlash) { 19 | return `${inputPath}/`; 20 | } else { 21 | return inputPath; 22 | } 23 | } 24 | 25 | const getPublicUrl = appPackageJson => 26 | envPublicUrl || require(appPackageJson).homepage; 27 | 28 | // We use `PUBLIC_URL` environment variable or "homepage" field to infer 29 | // "public path" at which the app is served. 30 | // Webpack needs to know it to put the right 14 | 24 | 25 | 26 | 35 | What's my HTTP Status code 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "HTTP Status Code", 3 | "name": "Whats my HTTP status code", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /scripts/build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Do this as the first thing so that any code reading it knows the right env. 4 | process.env.BABEL_ENV = 'production'; 5 | process.env.NODE_ENV = 'production'; 6 | 7 | // Makes the script crash on unhandled rejections instead of silently 8 | // ignoring them. In the future, promise rejections that are not handled will 9 | // terminate the Node.js process with a non-zero exit code. 10 | process.on('unhandledRejection', err => { 11 | throw err; 12 | }); 13 | 14 | // Ensure environment variables are read. 15 | require('../config/env'); 16 | 17 | 18 | const path = require('path'); 19 | const chalk = require('chalk'); 20 | const fs = require('fs-extra'); 21 | const webpack = require('webpack'); 22 | const bfj = require('bfj'); 23 | const config = require('../config/webpack.config.prod'); 24 | const paths = require('../config/paths'); 25 | const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); 26 | const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); 27 | const printHostingInstructions = require('react-dev-utils/printHostingInstructions'); 28 | const FileSizeReporter = require('react-dev-utils/FileSizeReporter'); 29 | const printBuildError = require('react-dev-utils/printBuildError'); 30 | 31 | const measureFileSizesBeforeBuild = 32 | FileSizeReporter.measureFileSizesBeforeBuild; 33 | const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild; 34 | const useYarn = fs.existsSync(paths.yarnLockFile); 35 | 36 | // These sizes are pretty large. We'll warn for bundles exceeding them. 37 | const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024; 38 | const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024; 39 | 40 | const isInteractive = process.stdout.isTTY; 41 | 42 | // Warn and crash if required files are missing 43 | if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { 44 | process.exit(1); 45 | } 46 | 47 | // Process CLI arguments 48 | const argv = process.argv.slice(2); 49 | const writeStatsJson = argv.indexOf('--stats') !== -1; 50 | 51 | // We require that you explicitly set browsers and do not fall back to 52 | // browserslist defaults. 53 | const { checkBrowsers } = require('react-dev-utils/browsersHelper'); 54 | checkBrowsers(paths.appPath, isInteractive) 55 | .then(() => { 56 | // First, read the current file sizes in build directory. 57 | // This lets us display how much they changed later. 58 | return measureFileSizesBeforeBuild(paths.appBuild); 59 | }) 60 | .then(previousFileSizes => { 61 | // Remove all content but keep the directory so that 62 | // if you're in it, you don't end up in Trash 63 | fs.emptyDirSync(paths.appBuild); 64 | // Merge with the public folder 65 | copyPublicFolder(); 66 | // Start the webpack build 67 | return build(previousFileSizes); 68 | }) 69 | .then( 70 | ({ stats, previousFileSizes, warnings }) => { 71 | if (warnings.length) { 72 | console.log(chalk.yellow('Compiled with warnings.\n')); 73 | console.log(warnings.join('\n\n')); 74 | console.log( 75 | '\nSearch for the ' + 76 | chalk.underline(chalk.yellow('keywords')) + 77 | ' to learn more about each warning.' 78 | ); 79 | console.log( 80 | 'To ignore, add ' + 81 | chalk.cyan('// eslint-disable-next-line') + 82 | ' to the line before.\n' 83 | ); 84 | } else { 85 | console.log(chalk.green('Compiled successfully.\n')); 86 | } 87 | 88 | console.log('File sizes after gzip:\n'); 89 | printFileSizesAfterBuild( 90 | stats, 91 | previousFileSizes, 92 | paths.appBuild, 93 | WARN_AFTER_BUNDLE_GZIP_SIZE, 94 | WARN_AFTER_CHUNK_GZIP_SIZE 95 | ); 96 | console.log(); 97 | 98 | const appPackage = require(paths.appPackageJson); 99 | const publicUrl = paths.publicUrl; 100 | const publicPath = config.output.publicPath; 101 | const buildFolder = path.relative(process.cwd(), paths.appBuild); 102 | printHostingInstructions( 103 | appPackage, 104 | publicUrl, 105 | publicPath, 106 | buildFolder, 107 | useYarn 108 | ); 109 | }, 110 | err => { 111 | console.log(chalk.red('Failed to compile.\n')); 112 | printBuildError(err); 113 | process.exit(1); 114 | } 115 | ) 116 | .catch(err => { 117 | if (err && err.message) { 118 | console.log(err.message); 119 | } 120 | process.exit(1); 121 | }); 122 | 123 | // Create the production build and print the deployment instructions. 124 | function build(previousFileSizes) { 125 | console.log('Creating an optimized production build...'); 126 | 127 | let compiler = webpack(config); 128 | return new Promise((resolve, reject) => { 129 | compiler.run((err, stats) => { 130 | let messages; 131 | if (err) { 132 | if (!err.message) { 133 | return reject(err); 134 | } 135 | messages = formatWebpackMessages({ 136 | errors: [err.message], 137 | warnings: [], 138 | }); 139 | } else { 140 | messages = formatWebpackMessages( 141 | stats.toJson({ all: false, warnings: true, errors: true }) 142 | ); 143 | } 144 | if (messages.errors.length) { 145 | // Only keep the first error. Others are often indicative 146 | // of the same problem, but confuse the reader with noise. 147 | if (messages.errors.length > 1) { 148 | messages.errors.length = 1; 149 | } 150 | return reject(new Error(messages.errors.join('\n\n'))); 151 | } 152 | if ( 153 | process.env.CI && 154 | (typeof process.env.CI !== 'string' || 155 | process.env.CI.toLowerCase() !== 'false') && 156 | messages.warnings.length 157 | ) { 158 | console.log( 159 | chalk.yellow( 160 | '\nTreating warnings as errors because process.env.CI = true.\n' + 161 | 'Most CI servers set it automatically.\n' 162 | ) 163 | ); 164 | return reject(new Error(messages.warnings.join('\n\n'))); 165 | } 166 | 167 | const resolveArgs = { 168 | stats, 169 | previousFileSizes, 170 | warnings: messages.warnings, 171 | }; 172 | if (writeStatsJson) { 173 | return bfj 174 | .write(paths.appBuild + '/bundle-stats.json', stats.toJson()) 175 | .then(() => resolve(resolveArgs)) 176 | .catch(error => reject(new Error(error))); 177 | } 178 | 179 | return resolve(resolveArgs); 180 | }); 181 | }); 182 | } 183 | 184 | function copyPublicFolder() { 185 | fs.copySync(paths.appPublic, paths.appBuild, { 186 | dereference: true, 187 | filter: file => file !== paths.appHtml, 188 | }); 189 | } 190 | -------------------------------------------------------------------------------- /scripts/start.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Do this as the first thing so that any code reading it knows the right env. 4 | process.env.BABEL_ENV = 'development'; 5 | process.env.NODE_ENV = 'development'; 6 | 7 | // Makes the script crash on unhandled rejections instead of silently 8 | // ignoring them. In the future, promise rejections that are not handled will 9 | // terminate the Node.js process with a non-zero exit code. 10 | process.on('unhandledRejection', err => { 11 | throw err; 12 | }); 13 | 14 | // Ensure environment variables are read. 15 | require('../config/env'); 16 | 17 | 18 | const fs = require('fs'); 19 | const chalk = require('chalk'); 20 | const webpack = require('webpack'); 21 | const WebpackDevServer = require('webpack-dev-server'); 22 | const clearConsole = require('react-dev-utils/clearConsole'); 23 | const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); 24 | const { 25 | choosePort, 26 | createCompiler, 27 | prepareProxy, 28 | prepareUrls, 29 | } = require('react-dev-utils/WebpackDevServerUtils'); 30 | const openBrowser = require('react-dev-utils/openBrowser'); 31 | const paths = require('../config/paths'); 32 | const config = require('../config/webpack.config.dev'); 33 | const createDevServerConfig = require('../config/webpackDevServer.config'); 34 | 35 | const useYarn = fs.existsSync(paths.yarnLockFile); 36 | const isInteractive = process.stdout.isTTY; 37 | 38 | // Warn and crash if required files are missing 39 | if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { 40 | process.exit(1); 41 | } 42 | 43 | // Tools like Cloud9 rely on this. 44 | const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000; 45 | const HOST = process.env.HOST || '0.0.0.0'; 46 | 47 | if (process.env.HOST) { 48 | console.log( 49 | chalk.cyan( 50 | `Attempting to bind to HOST environment variable: ${chalk.yellow( 51 | chalk.bold(process.env.HOST) 52 | )}` 53 | ) 54 | ); 55 | console.log( 56 | `If this was unintentional, check that you haven't mistakenly set it in your shell.` 57 | ); 58 | console.log( 59 | `Learn more here: ${chalk.yellow('http://bit.ly/CRA-advanced-config')}` 60 | ); 61 | console.log(); 62 | } 63 | 64 | // We require that you explictly set browsers and do not fall back to 65 | // browserslist defaults. 66 | const { checkBrowsers } = require('react-dev-utils/browsersHelper'); 67 | checkBrowsers(paths.appPath, isInteractive) 68 | .then(() => { 69 | // We attempt to use the default port but if it is busy, we offer the user to 70 | // run on a different port. `choosePort()` Promise resolves to the next free port. 71 | return choosePort(HOST, DEFAULT_PORT); 72 | }) 73 | .then(port => { 74 | if (port == null) { 75 | // We have not found a port. 76 | return; 77 | } 78 | const protocol = process.env.HTTPS === 'true' ? 'https' : 'http'; 79 | const appName = require(paths.appPackageJson).name; 80 | const urls = prepareUrls(protocol, HOST, port); 81 | // Create a webpack compiler that is configured with custom messages. 82 | const compiler = createCompiler(webpack, config, appName, urls, useYarn); 83 | // Load proxy config 84 | const proxySetting = require(paths.appPackageJson).proxy; 85 | const proxyConfig = prepareProxy(proxySetting, paths.appPublic); 86 | // Serve webpack assets generated by the compiler over a web server. 87 | const serverConfig = createDevServerConfig( 88 | proxyConfig, 89 | urls.lanUrlForConfig 90 | ); 91 | const devServer = new WebpackDevServer(compiler, serverConfig); 92 | // Launch WebpackDevServer. 93 | devServer.listen(port, HOST, err => { 94 | if (err) { 95 | return console.log(err); 96 | } 97 | if (isInteractive) { 98 | clearConsole(); 99 | } 100 | console.log(chalk.cyan('Starting the development server...\n')); 101 | openBrowser(urls.localUrlForBrowser); 102 | }); 103 | 104 | ['SIGINT', 'SIGTERM'].forEach(function(sig) { 105 | process.on(sig, function() { 106 | devServer.close(); 107 | process.exit(); 108 | }); 109 | }); 110 | }) 111 | .catch(err => { 112 | if (err && err.message) { 113 | console.log(err.message); 114 | } 115 | process.exit(1); 116 | }); 117 | -------------------------------------------------------------------------------- /scripts/test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Do this as the first thing so that any code reading it knows the right env. 4 | process.env.BABEL_ENV = 'test'; 5 | process.env.NODE_ENV = 'test'; 6 | process.env.PUBLIC_URL = ''; 7 | 8 | // Makes the script crash on unhandled rejections instead of silently 9 | // ignoring them. In the future, promise rejections that are not handled will 10 | // terminate the Node.js process with a non-zero exit code. 11 | process.on('unhandledRejection', err => { 12 | throw err; 13 | }); 14 | 15 | // Ensure environment variables are read. 16 | require('../config/env'); 17 | 18 | 19 | const jest = require('jest'); 20 | const execSync = require('child_process').execSync; 21 | let argv = process.argv.slice(2); 22 | 23 | function isInGitRepository() { 24 | try { 25 | execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' }); 26 | return true; 27 | } catch (e) { 28 | return false; 29 | } 30 | } 31 | 32 | function isInMercurialRepository() { 33 | try { 34 | execSync('hg --cwd . root', { stdio: 'ignore' }); 35 | return true; 36 | } catch (e) { 37 | return false; 38 | } 39 | } 40 | 41 | // Watch unless on CI, in coverage mode, or explicitly running all tests 42 | if ( 43 | !process.env.CI && 44 | argv.indexOf('--coverage') === -1 && 45 | argv.indexOf('--watchAll') === -1 46 | ) { 47 | // https://github.com/facebook/create-react-app/issues/5210 48 | const hasSourceControl = isInGitRepository() || isInMercurialRepository(); 49 | argv.push(hasSourceControl ? '--watch' : '--watchAll'); 50 | } 51 | 52 | 53 | jest.run(argv); 54 | -------------------------------------------------------------------------------- /src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import { HashRouter as Router } from 'react-router-dom'; 4 | import configureStore from 'redux-mock-store'; 5 | import { Provider } from 'react-redux'; 6 | import thunk from 'redux-thunk'; 7 | 8 | import App from './containers/appContainer'; 9 | 10 | const initialState = { 11 | application: { 12 | version: '0.0.0', 13 | name: 'application' 14 | }, 15 | httpInfo: { questions: {} } 16 | }; 17 | const middlewares = [thunk]; 18 | const mockStore = configureStore(middlewares); 19 | const store = mockStore(initialState); 20 | 21 | it('renders without crashing', () => { 22 | const div = document.createElement('div'); 23 | ReactDOM.render( 24 | 25 | 26 | 27 | 28 | , 29 | div 30 | ); 31 | ReactDOM.unmountComponentAtNode(div); 32 | }); 33 | -------------------------------------------------------------------------------- /src/actions/actionTypes.js: -------------------------------------------------------------------------------- 1 | export const FETCH_STABILITY_DATA = 'FETCH_STABILITY_DATA'; 2 | export const FETCH_RELATED_SITES = 'FETCH_RELATED_SITES'; 3 | export const FETCH_HTTPCODES_SERIES = 'FETCH_HTTPCODES_SERIES'; 4 | export const FETCH_HTTPCODES_SERIES_QUESTIONS = 'FETCH_HTTPCODES_SERIES_QUESTIONS'; 5 | export const FETCH_HTTPCODES = 'FETCH_HTTPCODES'; 6 | export const FETCH_HTTPCODES_QUESTIONS = 'FETCH_HTTPCODES_QUESTIONS'; 7 | -------------------------------------------------------------------------------- /src/actions/httpInfoAction.js: -------------------------------------------------------------------------------- 1 | import * as actionTypes from './actionTypes'; 2 | import * as httpAPI from '../apis/httpInfoApi'; 3 | 4 | const fetchStabilityDataAction = stabilityData => { 5 | return { 6 | type: actionTypes.FETCH_STABILITY_DATA, 7 | payload: { 8 | stability: stabilityData 9 | } 10 | }; 11 | }; 12 | 13 | const fetchRelatedSitesDataAction = sitesData => { 14 | return { 15 | type: actionTypes.FETCH_RELATED_SITES, 16 | payload: { 17 | sites: sitesData 18 | } 19 | }; 20 | }; 21 | 22 | const fetchhttpCodeSeriesDataAction = classesData => { 23 | return { 24 | type: actionTypes.FETCH_HTTPCODES_SERIES, 25 | payload: { 26 | httpCodeSeries: classesData 27 | } 28 | }; 29 | }; 30 | 31 | const fetchhttpCodeSeriesQuestionAction = questions => { 32 | return { 33 | type: actionTypes.FETCH_HTTPCODES_SERIES_QUESTIONS, 34 | payload: { 35 | httpCodeSeries: questions 36 | } 37 | }; 38 | }; 39 | 40 | const fetchHttpCodesDataAction = httpCodes => { 41 | return { 42 | type: actionTypes.FETCH_HTTPCODES, 43 | payload: { 44 | httpCodes: httpCodes 45 | } 46 | }; 47 | }; 48 | 49 | const fetchHttpCodesQuestionAction = questions => { 50 | return { 51 | type: actionTypes.FETCH_HTTPCODES_QUESTIONS, 52 | payload: { 53 | httpCodes: questions 54 | } 55 | }; 56 | }; 57 | 58 | const fetchRelatedSitesData = () => { 59 | return async dispatch => { 60 | const relatedSites = await httpAPI.fetchRelatedSitesSchemas(); 61 | dispatch(fetchRelatedSitesDataAction(relatedSites)); 62 | }; 63 | }; 64 | 65 | const fetchStabilityData = () => { 66 | return async dispatch => { 67 | const stabilityInfo = await httpAPI.fetchStabilitySchemas(); 68 | dispatch(fetchStabilityDataAction(stabilityInfo)); 69 | }; 70 | }; 71 | 72 | const fetchhttpCodeSeriesData = () => { 73 | return async dispatch => { 74 | const httpClassInfo = await httpAPI.fetchhttpCodeSeriesSchemas(); 75 | dispatch(fetchhttpCodeSeriesDataAction(httpClassInfo)); 76 | }; 77 | }; 78 | 79 | const fetchhttpCodeSeriesQuestions = () => { 80 | return async dispatch => { 81 | const codeClassQuestions = await httpAPI.fetchhttpCodeSeriesQuestions(); 82 | dispatch(fetchhttpCodeSeriesQuestionAction(codeClassQuestions)); 83 | }; 84 | }; 85 | 86 | const fetchHttpCodesData = () => { 87 | return async dispatch => { 88 | const httpCodesInfo = await httpAPI.fetchHttpCodeSchemas(); 89 | dispatch(fetchHttpCodesDataAction(httpCodesInfo)); 90 | }; 91 | }; 92 | 93 | const fetchHttpCodesQuestions = () => { 94 | return async dispatch => { 95 | const httpCodeQuestions = await httpAPI.fetchHttpCodeQuestions(); 96 | dispatch(fetchHttpCodesQuestionAction(httpCodeQuestions)); 97 | }; 98 | }; 99 | 100 | const fetchAllHTTPInfo = () => { 101 | return async dispatch => { 102 | dispatch(fetchStabilityData()); 103 | dispatch(fetchRelatedSitesData()); 104 | dispatch(fetchhttpCodeSeriesData()); 105 | dispatch(fetchHttpCodesData()); 106 | dispatch(fetchhttpCodeSeriesQuestions()); 107 | dispatch(fetchHttpCodesQuestions()); 108 | }; 109 | }; 110 | 111 | export { fetchAllHTTPInfo, fetchHttpCodesQuestions, fetchhttpCodeSeriesQuestions, fetchHttpCodesData, fetchhttpCodeSeriesData, fetchStabilityData, fetchRelatedSitesData }; 112 | -------------------------------------------------------------------------------- /src/apis/data/codes/1xx.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "code": 100, 4 | "msg": "100 Continue", 5 | "description": "The initial part of a request has been received and has not yet been rejected by the server. The server intends to send a final response after the request has been fully received and acted upon.", 6 | "additionalInfo": [ 7 | "When the request contains an Expect header field that includes a 100-continue expectation, the 100 response indicates that the server wishes to receive the request payload body. The client ought to continue sending the request and discard the 100 response.", 8 | "If the request did not contain an Expect header field containing the 100-continue expectation, the client can simply discard this interim response." 9 | ], 10 | "more": "https://httpstatuses.com/100" 11 | }, 12 | { 13 | "code": 101, 14 | "msg": "101 SWITCHING PROTOCOLS", 15 | "description": "The server understands and is willing to comply with the client's request, via the Upgrade header field, for a change in the application protocol being used on this connection.", 16 | "additionalInfo": [ 17 | "The server MUST generate an Upgrade header field in the response that indicates which protocol(s) will be switched to immediately after the empty line that terminates the 101 response.", 18 | "It is assumed that the server will only agree to switch protocols when it is advantageous to do so. For example, switching to a newer version of HTTP might be advantageous over older versions, and switching to a real-time, synchronous protocol might be advantageous when delivering resources that use such features." 19 | ], 20 | "more": "https://httpstatuses.com/101" 21 | }, 22 | { 23 | "code": 102, 24 | "msg": "102 PROCESSING", 25 | "description": "An interim response used to inform the client that the server has accepted the complete request, but has not yet completed it.", 26 | "additionalInfo": [ 27 | "This status code SHOULD only be sent when the server has a reasonable expectation that the request will take significant time to complete. As guidance, if a method is taking longer than 20 seconds (a reasonable, but arbitrary value) to process the server SHOULD return a 102 (Processing) response. The server MUST send a final response after the request has been completed. ", 28 | "Methods can potentially take a long period of time to process, especially methods that support the Depth header. In such cases the client may time-out the connection while waiting for a response. To prevent this the server may return a 102 Processing status code to indicate to the client that the server is still processing the method." 29 | ], 30 | "more": "https://httpstatuses.com/102" 31 | } 32 | ] 33 | -------------------------------------------------------------------------------- /src/apis/data/codes/2xx.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "code": 200, 4 | "msg": "200 OK", 5 | "description": "The request has succeeded.", 6 | "additionalInfo": [ 7 | "The payload sent in a 200 response depends on the request method. For the methods defined by this specification, the intended meaning of the payload can be summarized as:", 8 | "`GET` a representation of the target resource", 9 | "`HEAD` the same representation as GET, but without the representation data", 10 | "`POST` a representation of the status of, or results obtained from, the action;", 11 | "`PUT` `DELETE` a representation of the status of the action;", 12 | "`OPTIONS` a representation of the communications options;", 13 | "`TRACE` a representation of the request message as received by the end server.", 14 | "Aside from responses to CONNECT, a 200 response always has a payload, though an origin server MAY generate a payload body of zero length. If no payload is desired, an origin server ought to send 204 No Content instead. For CONNECT, no payload is allowed because the successful result is a tunnel, which begins immediately after the 200 response header section.", 15 | "A 200 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls." 16 | ], 17 | "more": "https://httpstatuses.com/200" 18 | }, 19 | { 20 | "code": 201, 21 | "msg": "201 CREATED", 22 | "description": "The request has been fulfilled and has resulted in one or more new resources being created.", 23 | "additionalInfo": ["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.", "The 201 response payload typically describes and links to the resource(s) created. "], 24 | "more": "https://httpstatuses.com/201" 25 | }, 26 | { 27 | "code": 202, 28 | "msg": "202 ACCEPTED", 29 | "description": "The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place.", 30 | "additionalInfo": [ 31 | "There is no facility in HTTP for re-sending a status code from an asynchronous operation.", 32 | "The 202 response is intentionally noncommittal. Its purpose is to allow a server to accept a request for some other process (perhaps a batch-oriented process that is only run once per day) without requiring that the user agent's connection to the server persist until the process is completed. The representation sent with this response ought to describe the request's current status and point to (or embed) a status monitor that can provide the user with an estimate of when the request will be fulfilled." 33 | ], 34 | "more": "https://httpstatuses.com/202" 35 | }, 36 | { 37 | "code": 203, 38 | "msg": "203 NON-AUTHORITATIVE INFORMATION", 39 | "description": "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.", 40 | "additionalInfo": [ 41 | "This status code allows the proxy to notify recipients when a transformation has been applied, since that knowledge might impact later decisions regarding the content. For example, future cache validation requests for the content might only be applicable along the same request path (through the same proxies).", 42 | "The 203 response is similar to the Warning code of 214 Transformation Applied, which has the advantage of being applicable to responses with any status code.", 43 | "A 203 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls." 44 | ], 45 | "more": "https://httpstatuses.com/203" 46 | }, 47 | { 48 | "code": 204, 49 | "msg": "204 NO CONTENT", 50 | "description": "The server has successfully fulfilled the request and that there is no additional content to send in the response payload body.", 51 | "additionalInfo": [ 52 | "Metadata in the response header fields refer to the target resource and its selected representation after the requested action was applied.", 53 | "For example, if a 204 status code is received in response to a PUT request and the response contains an ETag header field, then the PUT was successful and the ETag field-value contains the entity-tag for the new representation of that target resource.", 54 | "The 204 response allows a server to indicate that the action has been successfully applied to the target resource, while implying that the user agent does not need to traverse away from its current \"document view\" (if any). The server assumes that the user agent will provide some indication of the success to its user, in accord with its own interface, and apply any new or updated metadata in the response to its active representation.", 55 | "For example, a 204 status code is commonly used with document editing interfaces corresponding to a \"save\" action, such that the document being saved remains available to the user for editing. It is also frequently used with interfaces that expect automated data transfers to be prevalent, such as within distributed version control systems.", 56 | "A 204 response is terminated by the first empty line after the header fields because it cannot contain a message body.", 57 | "A 204 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls." 58 | ], 59 | "more": "https://httpstatuses.com/204" 60 | }, 61 | { 62 | "code": 205, 63 | "msg": "205 RESET CONTENT", 64 | "description": "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.", 65 | "additionalInfo": [ 66 | "This response is intended to support a common data entry use case where the user receives content that supports data entry (a form, notepad, canvas, etc.), enters or manipulates data in that space, causes the entered data to be submitted in a request, and then the data entry mechanism is reset for the next entry so that the user can easily initiate another input action.", 67 | "Since the 205 status code implies that no additional content will be provided, a server MUST NOT generate a payload in a 205 response. In other words, a server MUST do one of the following for a 205 response: a) indicate a zero-length body for the response by including a Content-Length header field with a value of 0; b) indicate a zero-length payload for the response by including a Transfer-Encoding header field with a value of chunked and a message body consisting of a single chunk of zero-length; or, c) close the connection immediately after sending the blank line terminating the header section." 68 | ], 69 | "more": "https://httpstatuses.com/205" 70 | }, 71 | { 72 | "code": 206, 73 | "msg": "206 PARTIAL CONTENT", 74 | "description": "The server is successfully fulfilling a range request for the target resource by transferring one or more parts of the selected representation that correspond to the satisfiable ranges found in the request's Range header field.", 75 | "additionalInfo": ["A 206 response is cacheable by default; i.e., unless otherwise indicated by explicit cache controls"], 76 | "more": "https://httpstatuses.com/206" 77 | }, 78 | { 79 | "code": 207, 80 | "msg": "207 MULTI-STATUS", 81 | "description": "A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate.", 82 | "additionalInfo": ["Although '207' is used as the overall response status code, the recipient needs to consult the contents of the multistatus response body for further information about the success or failure of the method execution. The response MAY be used in success, partial success and also in failure situations."], 83 | "more": "https://httpstatuses.com/207" 84 | }, 85 | { 86 | "code": 208, 87 | "msg": "208 ALREADY REPORTED", 88 | "description": "Used inside a DAV: propstat response element to avoid enumerating the internal members of multiple bindings to the same collection repeatedly.", 89 | "additionalInfo": [ 90 | "For each binding to a collection inside the request's scope, only one will be reported with a 200 status, while subsequent DAV:response elements for all other bindings will use the 208 status, and no DAV:response elements for their descendants are included.", 91 | "Note that the 208 status will only occur for \"Depth: infinity\" requests, and that it is of particular importance when the multiple collection bindings cause a bind loop", 92 | "A client can request the DAV:resource-id property in a PROPFIND request to guarantee that they can accurately reconstruct the binding structure of a collection with multiple bindings to a single resource.", 93 | "For backward compatibility with clients not aware of the 208 status code appearing in multistatus response bodies, it SHOULD NOT be used unless the client has signaled support for this specification using the \"DAV\" request header. Instead, a 508 Loop Detected status should be returned when a binding loop is discovered. This allows the server to return the 508 as the top-level return status, if it discovers it before it started the response, or in the middle of a multistatus, if it discovers it in the middle of streaming out a multistatus response." 94 | ], 95 | "more": "https://httpstatuses.com/208" 96 | }, 97 | { 98 | "code": 226, 99 | "msg": "226 IM USED", 100 | "description": "The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.", 101 | "additionalInfo": [ 102 | "The actual current instance might not be available except by combining this response with other previous or future responses, as appropriate for the specific instance-manipulation(s). If so, the headers of the resulting instance are the result of combining the headers from the 226 response and the other instances, following the rules in section 13.5.3 of the HTTP/1.1 specification.", 103 | "The request MUST have included an A-IM header field listing at least one instance-manipulation. The response MUST include an Etag header field giving the entity tag of the current instance.", 104 | "A response received with a status code of 226 MAY be stored by a cache and used in reply to a subsequent request, subject to the HTTP expiration mechanism and any Cache-Control headers, and to the requirements in section 10.6.", 105 | "A response received with a status code of 226 MAY be used by a cache, in conjunction with a cache entry for the base instance, to create a cache entry for the current instance." 106 | ], 107 | "more": "https://httpstatuses.com/226" 108 | } 109 | ] 110 | -------------------------------------------------------------------------------- /src/apis/data/codes/3xx.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "code": 300, 4 | "msg": "300 MULTIPLE CHOICES", 5 | "description": "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.", 6 | "additionalInfo": [ 7 | "In other words, the server desires that the user agent engage in reactive negotiation to select the most appropriate representation(s) for its needs.", 8 | "If the server has a preferred choice, the server SHOULD generate a Location header field containing a preferred choice's URI reference. The user agent MAY use the Location field value for automatic redirection.", 9 | "For request methods other than HEAD, the server SHOULD generate a payload in the 300 response containing a list of representation metadata and URI reference(s) from which the user or user agent can choose the one most preferred. The user agent MAY make a selection from that list automatically if it understands the provided media type. A specific format for automatic selection is not defined by this specification because HTTP tries to remain orthogonal to the definition of its payloads. In practice, the representation is provided in some easily parsed format believed to be acceptable to the user agent, as determined by shared design or content negotiation, or in some commonly accepted hypertext format.", 10 | "A 300 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls.", 11 | "Note: The original proposal for the 300 status code defined the URI header field as providing a list of alternative representations, such that it would be usable for 200, 300, and 406 responses and be transferred in responses to the HEAD method. However, lack of deployment and disagreement over syntax led to both URI and Alternates (a subsequent proposal) being dropped from this specification. It is possible to communicate the list using a set of Link header fields, each with a relationship of \"alternate\", though deployment is a chicken-and-egg problem." 12 | ], 13 | "more": "https://httpstatuses.com/300" 14 | }, 15 | { 16 | "code": 301, 17 | "msg": "301 MOVED PERMANENTLY", 18 | "description": "The target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs.", 19 | "additionalInfo": [ 20 | "Clients with link-editing capabilities ought to automatically re-link references to the effective request URI to one or more of the new references sent by the server, where possible.", 21 | "The server SHOULD generate a Location header field in the response containing a preferred URI reference for the new permanent URI. The user agent MAY use the Location field value for automatic redirection. The server's response payload usually contains a short hypertext note with a hyperlink to the new URI(s)", 22 | "Note: For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request. If this behavior is undesired, the 307 Temporary Redirect status code can be used instead.", 23 | "A 301 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls." 24 | ], 25 | "more": "https://httpstatuses.com/301" 26 | }, 27 | { 28 | "code": 302, 29 | "msg": "302 FOUND", 30 | "description": "The target resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client ought to continue to use the effective request URI for future requests.", 31 | "additionalInfo": [ 32 | "The server SHOULD generate a Location header field in the response containing a URI reference for the different URI. The user agent MAY use the Location field value for automatic redirection. The server's response payload usually contains a short hypertext note with a hyperlink to the different URI(s).", 33 | "Note: For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request. If this behavior is undesired, the 307 Temporary Redirect status code can be used instead." 34 | ], 35 | "more": "https://httpstatuses.com/302" 36 | }, 37 | { 38 | "code": 303, 39 | "msg": "303 SEE OTHER", 40 | "description": "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.", 41 | "additionalInfo": [ 42 | "A user agent can perform a retrieval request targeting that URI (a GET or HEAD request if using HTTP), which might also be redirected, and present the eventual result as an answer to the original request. Note that the new URI in the Location header field is not considered equivalent to the effective request URI.", 43 | "This status code is applicable to any HTTP method. It is primarily used to allow the output of a POST action to redirect the user agent to a selected resource, since doing so provides the information corresponding to the POST response in a form that can be separately identified, bookmarked, and cached, independent of the original request.", 44 | "A 303 response to a GET request indicates that the origin server does not have a representation of the target resource that can be transferred by the server over HTTP. However, the Location field value refers to a resource that is descriptive of the target resource, such that making a retrieval request on that other resource might result in a representation that is useful to recipients without implying that it represents the original target resource. Note that answers to the questions of what can be represented, what representations are adequate, and what might be a useful description are outside the scope of HTTP.", 45 | "Except for responses to a HEAD request, the representation of a 303 response ought to contain a short hypertext note with a hyperlink to the same URI reference provided in the Location header field." 46 | ], 47 | "more": "https://httpstatuses.com/303" 48 | }, 49 | { 50 | "code": 304, 51 | "msg": "304 Not Modified", 52 | "description": "A conditional GET or HEAD request has been received and would have resulted in a 200 OK response if it were not for the fact that the condition evaluated to false.", 53 | "additionalInfo": [ 54 | "In other words, there is no need for the server to transfer a representation of the target resource because the request indicates that the client, which made the request conditional, already has a valid representation; the server is therefore redirecting the client to make use of that stored representation as if it were the payload of a 200 OK response.", 55 | "The server generating a 304 response MUST generate any of the following header fields that would have been sent in a 200 OK response to the same request: Cache-Control, Content-Location, Date, ETag, Expires, and Vary.", 56 | "Since the goal of a 304 response is to minimize information transfer when the recipient already has one or more cached representations, a sender SHOULD NOT generate representation metadata other than the above listed fields unless said metadata exists for the purpose of guiding cache updates (e.g., Last-Modified might be useful if the response does not have an ETag field).", 57 | "Requirements on a cache that receives a 304 response are defined in Section 4.3.4 of RFC7234. If the conditional request originated with an outbound client, such as a user agent with its own cache sending a conditional GET to a shared proxy, then the proxy SHOULD forward the 304 response to that client.", 58 | "A 304 response cannot contain a message-body; it is always terminated by the first empty line after the header fields." 59 | ], 60 | "more": "https://httpstatuses.com/304" 61 | }, 62 | { 63 | "code": 305, 64 | "msg": "305 USE PROXY", 65 | "description": "Defined in a previous version of this specification and is now deprecated, due to security concerns regarding in-band configuration of a proxy.", 66 | "additionalInfo": [], 67 | "more": "https://httpstatuses.com/305" 68 | }, 69 | { 70 | "code": 307, 71 | "msg": "307 TEMPORARY REDIRECT", 72 | "description": "The target resource resides temporarily under a different URI and the user agent MUST NOT change the request method if it performs an automatic redirection to that URI.", 73 | "additionalInfo": [ 74 | "Since the redirection can change over time, the client ought to continue using the original effective request URI for future requests.", 75 | "The server SHOULD generate a Location header field in the response containing a URI reference for the different URI. The user agent MAY use the Location field value for automatic redirection. The server's response payload usually contains a short hypertext note with a hyperlink to the different URI(s).", 76 | "Note: This status code is similar to 302 Found, except that it does not allow changing the request method from POST to GET. This specification defines no equivalent counterpart for 301 Moved Permanently (RFC7238, however, proposes defining the status code 308 Permanent Redirect for this purpose)." 77 | ], 78 | "more": "https://httpstatuses.com/307" 79 | }, 80 | { 81 | "code": 308, 82 | "msg": "308 PERMANENT REDIRECT", 83 | "description": "The target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs.", 84 | "additionalInfo": [ 85 | "Clients with link editing capabilities ought to automatically re-link references to the effective request URI to one or more of the new references sent by the server, where possible.", 86 | "The server SHOULD generate a Location header field in the response containing a preferred URI reference for the new permanent URI. The user agent MAY use the Location field value for automatic redirection. The server's response payload usually contains a short hypertext note with a hyperlink to the new URI(s).", 87 | "A 308 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls.", 88 | "Note: This status code is similar to 301 Moved Permanently, except that it does not allow changing the request method from POST to GET." 89 | ], 90 | "more": "https://httpstatuses.com/308" 91 | } 92 | ] 93 | -------------------------------------------------------------------------------- /src/apis/data/codes/4xx.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "code": 400, 4 | "msg": "400 BAD REQUEST", 5 | "description": "The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).", 6 | "additionalInfo": [], 7 | "more": "https://httpstatuses.com/400" 8 | }, 9 | { 10 | "code": 401, 11 | "msg": "401 UNAUTHORIZED", 12 | "description": "The request has not been applied because it lacks valid authentication credentials for the target resource.", 13 | "additionalInfo": [ 14 | "The server generating a 401 response MUST send a WWW-Authenticate header field containing at least one challenge applicable to the target resource.", 15 | "If the request included authentication credentials, then the 401 response indicates that authorization has been refused for those credentials. The user agent MAY repeat the request with a new or replaced Authorization header field. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user agent SHOULD present the enclosed representation to the user, since it usually contains relevant diagnostic information." 16 | ], 17 | "more": "https://httpstatuses.com/401" 18 | }, 19 | { 20 | "code": 402, 21 | "msg": "402 PAYMENT REQUIRED", 22 | "description": "Reserved for future use.", 23 | "additionalInfo": ["Because Money"], 24 | "more": "https://httpstatuses.com/402" 25 | }, 26 | { 27 | "code": 403, 28 | "msg": "403 FORBIDDEN", 29 | "description": "The server understood the request but refuses to authorize it.", 30 | "additionalInfo": [ 31 | "A server that wishes to make public why the request has been forbidden can describe that reason in the response payload (if any).", 32 | "If authentication credentials were provided in the request, the server considers them insufficient to grant access. The client SHOULD NOT automatically repeat the request with the same credentials. The client MAY repeat the request with new or different credentials. However, a request might be forbidden for reasons unrelated to the credentials.", 33 | "An origin server that wishes to \"hide\" the current existence of a forbidden target resource MAY instead respond with a status code of 404 Not Found." 34 | ], 35 | "more": "https://httpstatuses.com/403" 36 | }, 37 | { 38 | "code": 404, 39 | "msg": "404 NOT FOUND", 40 | "description": "The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.", 41 | "additionalInfo": [ 42 | "A 404 status code does not indicate whether this lack of representation is temporary or permanent; the 410 Gone status code is preferred over 404 if the origin server knows, presumably through some configurable means, that the condition is likely to be permanent.", 43 | "A 404 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls." 44 | ], 45 | "more": "https://httpstatuses.com/404" 46 | }, 47 | { 48 | "code": 405, 49 | "msg": "405 METHOD NOT ALLOWED", 50 | "description": "The method received in the request-line is known by the origin server but not supported by the target resource.", 51 | "additionalInfo": ["The origin server MUST generate an Allow header field in a 405 response containing a list of the target resource's currently supported methods.", "A 405 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls."], 52 | "more": "https://httpstatuses.com/405" 53 | }, 54 | { 55 | "code": 407, 56 | "msg": "407 PROXY AUTHENTICATION REQUIRED", 57 | "description": "Similar to 401 Unauthorized, but it indicates that the client needs to authenticate itself in order to use a proxy.", 58 | "additionalInfo": ["The proxy MUST send a Proxy-Authenticate header field containing a challenge applicable to that proxy for the target resource. The client MAY repeat the request with a new or replaced Proxy-Authorization header field."], 59 | "more": "https://httpstatuses.com/407" 60 | }, 61 | { 62 | "code": 408, 63 | "msg": "408 REQUEST TIMEOUT", 64 | "description": "The server did not receive a complete request message within the time that it was prepared to wait.", 65 | "additionalInfo": ["A server SHOULD send the \"close\" connection option in the response, since 408 implies that the server has decided to close the connection rather than continue waiting. If the client has an outstanding request in transit, the client MAY repeat that request on a new connection."], 66 | "more": "https://httpstatuses.com/408" 67 | }, 68 | { 69 | "code": 409, 70 | "msg": "409 CONFLICT", 71 | "description": "The request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request.", 72 | "additionalInfo": [ 73 | "The server SHOULD generate a payload that includes enough information for a user to recognize the source of the conflict.", 74 | "Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the representation being PUT included changes to a resource that conflict with those made by an earlier (third-party) request, the origin server might use a 409 response to indicate that it can't complete the request. In this case, the response representation would likely contain information useful for merging the differences based on the revision history." 75 | ], 76 | "more": "https://httpstatuses.com/409" 77 | }, 78 | { 79 | "code": 410, 80 | "msg": "410 GONE", 81 | "description": "The target resource is no longer available at the origin server and that this condition is likely to be permanent.", 82 | "additionalInfo": [ 83 | "If the origin server does not know, or has no facility to determine, whether or not the condition is permanent, the status code 404 Not Found ought to be used instead.", 84 | "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. Such an event is common for limited-time, promotional services and for resources belonging to individuals no longer associated with the origin server's site. It is not necessary to mark all permanently unavailable resources as \"gone\" or to keep the mark for any length of time -- that is left to the discretion of the server owner.", 85 | "A 410 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls." 86 | ], 87 | "more": "https://httpstatuses.com/410" 88 | }, 89 | { 90 | "code": 411, 91 | "msg": "411 LENGTH REQUIRED", 92 | "description": "The server refuses to accept the request without a defined Content-Length.", 93 | "additionalInfo": ["The client MAY repeat the request if it adds a valid Content-Length header field containing the length of the message body in the request message."], 94 | "more": "https://httpstatuses.com/411" 95 | }, 96 | { 97 | "code": 412, 98 | "msg": "412 PRECONDITION FAILED", 99 | "description": "One or more conditions given in the request header fields evaluated to false when tested on the server.", 100 | "additionalInfo": ["This response code allows the client to place preconditions on the current resource state (its current representations and metadata) and, thus, prevent the request method from being applied if the target resource is in an unexpected state."], 101 | "more": "https://httpstatuses.com/412" 102 | }, 103 | { 104 | "code": 413, 105 | "msg": "413 PAYLOAD TOO LARGE", 106 | "description": "The server is refusing to process a request because the request payload is larger than the server is willing or able to process.", 107 | "additionalInfo": ["The server MAY close the connection to prevent the client from continuing the request.", "If the condition is temporary, the server SHOULD generate a Retry-After header field to indicate that it is temporary and after what time the client MAY try again."], 108 | "more": "https://httpstatuses.com/413" 109 | }, 110 | { 111 | "code": 414, 112 | "msg": "414 REQUEST-URI TOO LONG", 113 | "description": "The server is refusing to service the request because the request-target is longer than the server is willing to interpret.", 114 | "additionalInfo": [ 115 | "This rare condition is only likely to occur when a client has improperly converted a POST request to a GET request with long query information, when the client has descended into a \"black hole\" of redirection (e.g., a redirected URI prefix that points to a suffix of itself) or when the server is under attack by a client attempting to exploit potential security holes.", 116 | "A 414 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls ." 117 | ], 118 | "more": "https://httpstatuses.com/414" 119 | }, 120 | { 121 | "code": 415, 122 | "msg": "415 UNSUPPORTED MEDIA TYPE", 123 | "description": "The origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource.", 124 | "additionalInfo": ["The format problem might be due to the request's indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly."], 125 | "more": "https://httpstatuses.com/415" 126 | }, 127 | { 128 | "code": 416, 129 | "msg": "416 REQUESTED RANGE NOT SATISFIABLE", 130 | "description": "None of the ranges in the request's Range header field overlap the current extent of the selected resource or that the set of ranges requested has been rejected due to invalid ranges or an excessive request of small or overlapping ranges.", 131 | "additionalInfo": [ 132 | "For byte ranges, failing to overlap the current extent means that the first-byte-pos of all of the byte-range-spec values were greater than the current length of the selected representation. When this status code is generated in response to a byte-range request, the sender SHOULD generate a Content-Range header field specifying the current length of the selected representation.", 133 | "Note: Because servers are free to ignore Range, many implementations will simply respond with the entire selected representation in a 200 OK response. That is partly because most clients are prepared to receive a 200 OK to complete the task (albeit less efficiently) and partly because clients might not stop making an invalid partial request until they have received a complete representation. Thus, clients cannot depend on receiving a 416 Range Not Satisfiable response even when it is most appropriate." 134 | ], 135 | "more": "https://httpstatuses.com/416" 136 | }, 137 | { 138 | "code": 417, 139 | "msg": "417 EXPECTATION FAILED", 140 | "description": "The expectation given in the request's Expect header field could not be met by at least one of the inbound servers.", 141 | "additionalInfo": [], 142 | "more": "https://httpstatuses.com/417" 143 | }, 144 | { 145 | "code": 418, 146 | "msg": "418 I'M A TEAPOT", 147 | "description": "Any attempt to brew coffee with a teapot should result in the error code \"418 I'm a teapot\". The resulting entity body MAY be short and stout.", 148 | "additionalInfo": [], 149 | "more": "https://httpstatuses.com/418" 150 | }, 151 | { 152 | "code": 420, 153 | "msg": "420 Enhance Your Calm (Twitter)", 154 | "description": "Not part of the HTTP standard, but returned by version 1 of the Twitter Search and Trends API when the client is being rate limited. Other services may wish to implement the 429 Too Many Requests response code instead.", 155 | "additionalInfo": [], 156 | "more": "" 157 | }, 158 | { 159 | "code": 421, 160 | "msg": "421 MISDIRECTED REQUEST", 161 | "description": "The request was directed at a server that is not able to produce a response. This can be sent by a server that is not configured to produce responses for the combination of scheme and authority that are included in the request URI.", 162 | "additionalInfo": [ 163 | "Clients receiving a 421 Misdirected Request response from a server MAY retry the request -- whether the request method is idempotent or not -- over a different connection. This is possible if a connection is reused or if an alternative service is selected ALT-SVC.", 164 | "This status code MUST NOT be generated by proxies.", 165 | "A 421 response is cacheable by default, i.e., unless otherwise indicated by the method definition or explicit cache controls." 166 | ], 167 | "more": "https://httpstatuses.com/421" 168 | }, 169 | { 170 | "code": 422, 171 | "msg": "422 UNPROCESSABLE ENTITY", 172 | "description": "The server understands the content type of the request entity (hence a 415 Unsupported Media Type status code is inappropriate), and the syntax of the request entity is correct (thus a 400 Bad Request status code is inappropriate) but was unable to process the contained instructions.", 173 | "additionalInfo": ["For example, this error condition may occur if an XML request body contains well-formed (i.e., syntactically correct), but semantically erroneous, XML instructions."], 174 | "more": "https://httpstatuses.com/422" 175 | }, 176 | { 177 | "code": 423, 178 | "msg": "423 LOCKED", 179 | "description": "The source or destination resource of a method is locked.", 180 | "additionalInfo": ["This response SHOULD contain an appropriate precondition or postcondition code, such as 'lock-token-submitted' or 'no-conflicting-lock'."], 181 | "more": "https://httpstatuses.com/423" 182 | }, 183 | { 184 | "code": 424, 185 | "msg": "424 FAILED DEPENDENCY", 186 | "description": "The method could not be performed on the resource because the requested action depended on another action and that action failed.", 187 | "additionalInfo": ["For example, if a command in a PROPPATCH method fails, then, at minimum, the rest of the commands will also fail with 424 Failed Dependency."], 188 | "more": "https://httpstatuses.com/424" 189 | }, 190 | { 191 | "code": 426, 192 | "msg": "426 UPGRADE REQUIRED", 193 | "description": "The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol.", 194 | "additionalInfo": ["The server MUST send an Upgrade header field in a 426 response to indicate the required protocol(s)"], 195 | "more": "https://httpstatuses.com/426" 196 | }, 197 | { 198 | "code": 428, 199 | "msg": "428 PRECONDITION REQUIRED", 200 | "description": "The origin server requires the request to be conditional.", 201 | "additionalInfo": [ 202 | "Its typical use is to avoid the \"lost update\" problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict. By requiring requests to be conditional, the server can assure that clients are working with the correct copies.", 203 | "Responses using this status code SHOULD explain how to resubmit the request successfully.", 204 | "Responses with the 428 status code MUST NOT be stored by a cache." 205 | ], 206 | "more": "https://httpstatuses.com/428" 207 | }, 208 | { 209 | "code": 429, 210 | "msg": "429 TOO MANY REQUESTS", 211 | "description": "The user has sent too many requests in a given amount of time (\"rate limiting\").", 212 | "additionalInfo": [ 213 | "The response representations SHOULD include details explaining the condition, and MAY include a Retry-After header indicating how long to wait before making a new request.", 214 | "Note that this specification does not define how the origin server identifies the user, nor how it counts requests. For example, an origin server that is limiting request rates can do so based upon counts of requests on a per-resource basis, across the entire server, or even among a set of servers. Likewise, it might identify the user by its authentication credentials, or a stateful cookie.", 215 | "Responses with the 429 status code MUST NOT be stored by a cache." 216 | ], 217 | "more": "https://httpstatuses.com/429" 218 | }, 219 | { 220 | "code": 431, 221 | "msg": "431 REQUEST HEADER FIELDS TOO LARGE", 222 | "description": "The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields.", 223 | "additionalInfo": ["It can be used both when the set of request header fields in total is too large, and when a single header field is at fault. In the latter case, the response representation SHOULD specify which header field was too large.", "Responses with the 431 status code MUST NOT be stored by a cache."], 224 | "more": "https://httpstatuses.com/431" 225 | }, 226 | { 227 | "code": 444, 228 | "msg": "444 CONNECTION CLOSED WITHOUT RESPONSE", 229 | "description": "A non-standard status code used to instruct nginx to close the connection without sending a response to the client, most commonly used to deny malicious or malformed requests.", 230 | "additionalInfo": ["This status code is not seen by the client, it only appears in nginx log files."], 231 | "more": "https://httpstatuses.com/444" 232 | }, 233 | { 234 | "code": 451, 235 | "msg": "451 UNAVAILABLE FOR LEGAL REASONS", 236 | "description": "The server is denying access to the resource as a consequence of a legal demand.", 237 | "additionalInfo": [ 238 | "The server in question might not be an origin server. This type of legal demand typically most directly affects the operations of ISPs and search engines.", 239 | "Responses using this status code SHOULD include an explanation, in the response body, of the details of the legal demand: the party making it, the applicable legislation or regulation, and what classes of person and resource it applies to.", 240 | "The use of the 451 status code implies neither the existence nor non- existence of the resource named in the request. That is to say, it is possible that if the legal demands were removed, a request for the resource still might not succeed.", 241 | "Note that in many cases clients can still access the denied resource by using technical countermeasures such as a VPN or the Tor network.", 242 | "A 451 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls; see RFC7234." 243 | ], 244 | "more": "https://httpstatuses.com/451" 245 | }, 246 | { 247 | "code": 499, 248 | "msg": "499 CLIENT CLOSED REQUEST", 249 | "description": "A non-standard status code introduced by nginx for the case when a client closes the connection while nginx is processing the request.", 250 | "additionalInfo": [], 251 | "more": "https://httpstatuses.com/499" 252 | } 253 | ] 254 | -------------------------------------------------------------------------------- /src/apis/data/codes/5xx.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "code": 500, 4 | "msg": "500 INTERNAL SERVER ERROR", 5 | "description": "The server encountered an unexpected condition that prevented it from fulfilling the request.", 6 | "additionalInfo": [], 7 | "more": "https://httpstatuses.com/500" 8 | }, 9 | { 10 | "code": 501, 11 | "msg": "501 NOT IMPLEMENTED", 12 | "description": "The server does not support the functionality required to fulfill the request.", 13 | "additionalInfo": ["This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource.", "A 501 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls"], 14 | "more": "https://httpstatuses.com/501" 15 | }, 16 | { 17 | "code": 502, 18 | "msg": "502 BAD GATEWAY", 19 | "description": "The server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request.", 20 | "additionalInfo": [], 21 | "more": "https://httpstatuses.com/502" 22 | }, 23 | { 24 | "code": 503, 25 | "msg": "503 SERVICE UNAVAILABLE", 26 | "description": "The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.", 27 | "additionalInfo": ["The server MAY send a Retry-After header field to suggest an appropriate amount of time for the client to wait before retrying the request.", "Note: The existence of the 503 status code does not imply that a server has to use it when becoming overloaded. Some servers might simply refuse the connection"], 28 | "more": "https://httpstatuses.com/503" 29 | }, 30 | { 31 | "code": 504, 32 | "msg": "504 GATEWAY TIMEOUT", 33 | "description": "The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request.", 34 | "additionalInfo": [], 35 | "more": "https://httpstatuses.com/504" 36 | }, 37 | { 38 | "code": 505, 39 | "msg": "505 HTTP VERSION NOT SUPPORTED", 40 | "description": "The server does not support, or refuses to support, the major version of HTTP that was used in the request message.", 41 | "additionalInfo": [ 42 | "The server is indicating that it is unable or unwilling to complete the request using the same major version as the client, as described in Section 2.6 of RFC7230, other than with this error message. The server SHOULD generate a representation for the 505 response that describes why that version is not supported and what other protocols are supported by that server." 43 | ], 44 | "more": "https://httpstatuses.com/505" 45 | }, 46 | { 47 | "code": 506, 48 | "msg": "506 VARIANT ALSO NEGOTIATES", 49 | "description": "The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.", 50 | "additionalInfo": [], 51 | "more": "https://httpstatuses.com/506" 52 | }, 53 | { 54 | "code": 507, 55 | "msg": "507 INSUFFICIENT STORAGE", 56 | "description": "The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request.", 57 | "additionalInfo": ["This condition is considered to be temporary. If the request that received this status code was the result of a user action, the request MUST NOT be repeated until it is requested by a separate user action."], 58 | "more": "https://httpstatuses.com/507" 59 | }, 60 | { 61 | "code": 508, 62 | "msg": "508 LOOP DETECTED", 63 | "description": "The server terminated an operation because it encountered an infinite loop while processing a request with \"Depth: infinity\". This status indicates that the entire operation failed.", 64 | "additionalInfo": [], 65 | "more": "https://httpstatuses.com/508" 66 | }, 67 | { 68 | "code": 510, 69 | "msg": "510 NOT EXTENDED", 70 | "description": "The policy for accessing the resource has not been met in the request. The server should send back all the information necessary for the client to issue an extended request.", 71 | "additionalInfo": [ 72 | "It is outside the scope of this specification to specify how the extensions inform the client.", 73 | "If the 510 response contains information about extensions that were not present in the initial request then the client MAY repeat the request if it has reason to believe it can fulfill the extension policy by modifying the request according to the information provided in the 510 response. Otherwise the client MAY present any entity included in the 510 response to the user, since that entity may include relevant diagnostic information." 74 | ], 75 | "more": "https://httpstatuses.com/510" 76 | }, 77 | { 78 | "code": 511, 79 | "msg": "511 NETWORK AUTHENTICATION REQUIRED", 80 | "description": "The client needs to authenticate to gain network access.", 81 | "additionalInfo": [ 82 | "The response representation SHOULD contain a link to a resource that allows the user to submit credentials (e.g., with an HTML form).", 83 | "Note that the 511 response SHOULD NOT contain a challenge or the login interface itself, because browsers would show the login interface as being associated with the originally requested URL, which may cause confusion.", 84 | "The 511 status SHOULD NOT be generated by origin servers; it is intended for use by intercepting proxies that are interposed as a means of controlling access to the network.", 85 | "Responses with the 511 status code MUST NOT be stored by a cache.", 86 | "The 511 status code is designed to mitigate problems caused by \"captive portals\" to software (especially non-browser agents) that is expecting a response from the server that a request was made to, not the intervening network infrastructure. It is not intended to encourage deployment of captive portals -- only to limit the damage caused by them." 87 | ], 88 | "more": "https://httpstatuses.com/511" 89 | }, 90 | { 91 | "code": 599, 92 | "msg": "599 NETWORK CONNECT TIMEOUT ERROR", 93 | "description": "This status code is not specified in any RFCs, but is used by some HTTP proxies to signal a network connect timeout behind the proxy to a client in front of the proxy.", 94 | "additionalInfo": [], 95 | "more": "https://httpstatuses.com/599" 96 | } 97 | ] 98 | -------------------------------------------------------------------------------- /src/apis/data/codes/index.js: -------------------------------------------------------------------------------- 1 | import series100 from './1xx.json'; 2 | import series200 from './2xx.json'; 3 | import series300 from './3xx.json'; 4 | import series400 from './4xx.json'; 5 | import series500 from './5xx.json'; 6 | 7 | export default { 8 | '1xx': series100, 9 | '2xx': series200, 10 | '3xx': series300, 11 | '4xx': series400, 12 | '5xx': series500 13 | }; 14 | -------------------------------------------------------------------------------- /src/apis/data/index.js: -------------------------------------------------------------------------------- 1 | import stabilityJSON from './stability.json'; 2 | import sitesJSON from './sites.json'; 3 | import httpSeriesJSON from './series.json'; 4 | import httpCodesJSON from './codes'; 5 | import httpSeriesQuestionJSON from './questions/httpSeriesCodeQuestions.json'; 6 | import httpCodesQuestionJSON from './questions/codes'; 7 | function getStabilityCodes() { 8 | return stabilityJSON; 9 | } 10 | 11 | function getRelatedSites() { 12 | return sitesJSON; 13 | } 14 | 15 | function gethttpCodeSeries() { 16 | return httpSeriesJSON; 17 | } 18 | 19 | function getHttpCodes() { 20 | return httpCodesJSON; 21 | } 22 | 23 | function gethttpCodeSeriesQuestions() { 24 | return httpSeriesQuestionJSON; 25 | } 26 | 27 | function getHttpCodeQuestions() { 28 | return httpCodesQuestionJSON; 29 | } 30 | 31 | export { getHttpCodes, getStabilityCodes, getRelatedSites, gethttpCodeSeries, gethttpCodeSeriesQuestions, getHttpCodeQuestions }; 32 | -------------------------------------------------------------------------------- /src/apis/data/questions/codes/1xx.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 0, 4 | "type": "suggestion", 5 | "mainText": "Check recommended codes for this series", 6 | "additionalTexts": [], 7 | "options": [ 8 | { "option": "all", "type": "bool", "action": { "type": "node", "value": ["100", "101", "102"] } }, 9 | { "option": "100 Continue", "type": "bool", "action": { "type": "node", "value": "100" } }, 10 | { "option": "101 Switching Protocols", "type": "bool", "action": { "type": "node", "value": "101" } }, 11 | { "option": "102 Processing", "type": "bool", "action": { "type": "node", "value": "102" } } 12 | ] 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /src/apis/data/questions/codes/2xx.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 0, 4 | "type": "question", 5 | "mainText": "Incoming request will be completed later?", 6 | "additionalTexts": [], 7 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["202"] } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 1 } }] 8 | }, 9 | { 10 | "id": 1, 11 | "type": "question", 12 | "mainText": "Is there no content for the request or the user's view should be unchanged from previous response?", 13 | "additionalTexts": [], 14 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["204"] } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 2 } }] 15 | }, 16 | { 17 | "id": 2, 18 | "type": "question", 19 | "mainText": "Are you implementing a web server to handle HTTP request?", 20 | "additionalTexts": [], 21 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["206", "304"] } }, { "option": "no", "type": "bool", "action": { "type": "node", "value": ["200"] } }] 22 | } 23 | ] 24 | -------------------------------------------------------------------------------- /src/apis/data/questions/codes/3xx.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 0, 4 | "type": "question", 5 | "mainText": "Is request referring to resource at new location?", 6 | "additionalTexts": [], 7 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "link", "value": 1 } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 2 } }] 8 | }, 9 | { 10 | "id": 1, 11 | "type": "question", 12 | "mainText": "Can the HTTP method of request change to GET verb?", 13 | "additionalTexts": [], 14 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "link", "value": 3 } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 4 } }] 15 | }, 16 | { 17 | "id": 2, 18 | "type": "question", 19 | "mainText": "Was the destination resource location created for/by this particular request?", 20 | "additionalTexts": [], 21 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["201"] } }, { "option": "no", "type": "bool", "action": { "type": "node", "value": ["303"] } }] 22 | }, 23 | { 24 | "id": 3, 25 | "type": "question", 26 | "mainText": "Is the redirected resource location temporary?", 27 | "additionalTexts": [], 28 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["302"] } }, { "option": "no", "type": "bool", "action": { "type": "node", "value": ["301"] } }] 29 | }, 30 | { 31 | "id": 4, 32 | "type": "question", 33 | "mainText": "Is the redirected resource Location temporary?", 34 | "additionalTexts": [], 35 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["307"] } }, { "option": "no", "type": "bool", "action": { "type": "node", "value": ["308"] } }] 36 | } 37 | ] 38 | -------------------------------------------------------------------------------- /src/apis/data/questions/codes/4xx.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 0, 4 | "type": "question", 5 | "mainText": "Is the request/user being throttled with rate limiting (more request made in short duration)?", 6 | "additionalTexts": [], 7 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "link", "value": 1 } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 2 } }] 8 | }, 9 | { 10 | "id": 1, 11 | "type": "question", 12 | "mainText": "Are you twitter or do you want to act cool with current request?", 13 | "additionalTexts": [], 14 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["420"] } }, { "option": "no", "type": "bool", "action": { "type": "node", "value": ["429"] } }] 15 | }, 16 | { 17 | "id": 2, 18 | "type": "question", 19 | "mainText": "Does the user need authentication for this request?", 20 | "additionalTexts": [], 21 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "link", "value": 3 } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 4 } }] 22 | }, 23 | { 24 | "id": 3, 25 | "type": "question", 26 | "mainText": "Are you using Basic HTTP auth (Header based Authentication)?", 27 | "additionalTexts": [], 28 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["401"] } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 5 } }] 29 | }, 30 | { 31 | "id": 4, 32 | "type": "question", 33 | "mainText": "Does the user have access/authorised to the resource (even if authenticated)?", 34 | "additionalTexts": [], 35 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "link", "value": 6 } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 5 } }] 36 | }, 37 | { 38 | "id": 5, 39 | "type": "question", 40 | "mainText": "Is the resource a secret and should not be known to user about its existence?", 41 | "additionalTexts": [], 42 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["404"] } }, { "option": "no", "type": "bool", "action": { "type": "node", "value": ["403"] } }] 43 | }, 44 | { 45 | "id": 6, 46 | "type": "question", 47 | "mainText": "Does the resource that is requested even exists?", 48 | "additionalTexts": [], 49 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "link", "value": 8 } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 7 } }] 50 | }, 51 | { 52 | "id": 7, 53 | "type": "question", 54 | "mainText": "Is resource removed or soft-deleted?", 55 | "additionalTexts": [], 56 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["410"] } }, { "option": "no", "type": "bool", "action": { "type": "node", "value": ["404"] } }] 57 | }, 58 | { 59 | "id": 8, 60 | "type": "question", 61 | "mainText": "Is the HTTP method/verb of the request allowed for the resource?", 62 | "additionalTexts": [], 63 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "link", "value": 9 } }, { "option": "no", "type": "bool", "action": { "type": "node", "value": ["405"] } }] 64 | }, 65 | { 66 | "id": 9, 67 | "type": "question", 68 | "mainText": "Is there any problem with the header of HTTP request?", 69 | "additionalTexts": [], 70 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "link", "value": 10 } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 11 } }] 71 | }, 72 | { 73 | "id": 10, 74 | "type": "question", 75 | "mainText": "Which header is missing from HTTP reqeust or is mandatory?", 76 | "additionalTexts": [], 77 | "options": [ 78 | { "option": "Accept", "type": "bool", "action": { "type": "node", "value": ["406"] } }, 79 | { "option": "content-length", "type": "bool", "action": { "type": "node", "value": ["411"] } }, 80 | { "option": "if-*", "type": "bool", "action": { "type": "node", "value": ["412"] } }, 81 | { "option": "content-type", "type": "bool", "action": { "type": "node", "value": ["415"] } }, 82 | { "option": "expect", "type": "bool", "action": { "type": "node", "value": ["417"] } }, 83 | { "option": "other", "type": "bool", "action": { "type": "link", "value": 11 } } 84 | ] 85 | }, 86 | { 87 | "id": 11, 88 | "type": "question", 89 | "mainText": "Is the request incompatible with previous request or condition?", 90 | "additionalTexts": [], 91 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["409"] } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 12 } }] 92 | }, 93 | { 94 | "id": 12, 95 | "type": "question", 96 | "mainText": "Is the request body/header well formed but is invalid or leading to unexpected inputs?", 97 | "additionalTexts": [], 98 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["422"] } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 13 } }] 99 | }, 100 | { 101 | "id": 13, 102 | "type": "question", 103 | "mainText": "Is it april 1st?", 104 | "additionalTexts": [], 105 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["418"] } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 14 } }] 106 | }, 107 | { 108 | "id": 14, 109 | "type": "question", 110 | "mainText": "Are you implementing a web server for handling HTTP request?", 111 | "additionalTexts": [], 112 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["408", "413", "414", "416", "426"] } }, { "option": "no", "type": "bool", "action": { "type": "node", "value": ["400"] } }] 113 | } 114 | ] 115 | -------------------------------------------------------------------------------- /src/apis/data/questions/codes/5xx.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 0, 4 | "type": "question", 5 | "mainText": "Should the user retry after sometime as it cannot be processed now?", 6 | "additionalTexts": [], 7 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["503"] } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 1 } }] 8 | }, 9 | { 10 | "id": 1, 11 | "type": "question", 12 | "mainText": "Is it a problem with third party service/server for this request?", 13 | "additionalTexts": [], 14 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "link", "value": 2 } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 3 } }] 15 | }, 16 | { 17 | "id": 2, 18 | "type": "question", 19 | "mainText": "Is the third party service/server responding to this request?", 20 | "additionalTexts": [], 21 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["502"] } }, { "option": "no", "type": "bool", "action": { "type": "node", "value": ["504"] } }] 22 | }, 23 | { 24 | "id": 3, 25 | "type": "question", 26 | "mainText": "Is that your code does not handle such request and will handle such request in future?", 27 | "additionalTexts": [], 28 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["501"] } }, { "option": "no", "type": "bool", "action": { "type": "node", "value": ["500"] } }] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /src/apis/data/questions/codes/index.js: -------------------------------------------------------------------------------- 1 | import series100 from './1xx.json'; 2 | import series200 from './2xx.json'; 3 | import series300 from './3xx.json'; 4 | import series400 from './4xx.json'; 5 | import series500 from './5xx.json'; 6 | 7 | export default { 8 | '1xx': series100, 9 | '2xx': series200, 10 | '3xx': series300, 11 | '4xx': series400, 12 | '5xx': series500 13 | }; 14 | -------------------------------------------------------------------------------- /src/apis/data/questions/httpSeriesCodeQuestions.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 0, 4 | "type": "question", 5 | "mainText": "Is there problem with the HTTP request?", 6 | "additionalTexts": [], 7 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["4xx"] } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 1 } }] 8 | }, 9 | { 10 | "id": 1, 11 | "type": "question", 12 | "mainText": "Is there problem at the server for incoming request?", 13 | "additionalTexts": [], 14 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["5xx"] } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 2 } }] 15 | }, 16 | { 17 | "id": 2, 18 | "type": "question", 19 | "mainText": "Are you implementing a web server to handle HTTP request?", 20 | "additionalTexts": ["Implementing anything that is above the application layer"], 21 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["1xx", "2xx", "3xx"] } }, { "option": "no", "type": "bool", "action": { "type": "link", "value": 3 } }] 22 | }, 23 | { 24 | "id": 3, 25 | "type": "question", 26 | "mainText": "Do you want to redirect the user to new location for this request?", 27 | "additionalTexts": ["Implementing anything that is above the application layer"], 28 | "options": [{ "option": "yes", "type": "bool", "action": { "type": "node", "value": ["3xx"] } }, { "option": "no", "type": "bool", "action": { "type": "node", "value": ["2xx"] } }] 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /src/apis/data/series.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "1xx", 4 | "description": "An informational response indicates that the request was received and understood. It is issued on a provisional basis while request processing continues. It alerts the client to wait for a final response", 5 | "type": "Informational", 6 | "stability": -1 7 | }, 8 | { 9 | "name": "2xx", 10 | "description": "This class of status codes indicates the action requested by the client was received, understood and accepted. This series indicate that the request was successful ", 11 | "type": "Success", 12 | "stability": 0 13 | }, 14 | { 15 | "name": "3xx", 16 | "description": "This class of status code indicates the client must take additional action to complete the request. Many of these status codes are used in URL redirection.", 17 | "type": "Redirection", 18 | "stability": 0 19 | }, 20 | { 21 | "name": "4xx", 22 | "description": "This class of status code is intended for situations in which the error seems to have been caused by the client. These status codes are applicable to any request method.", 23 | "type": "Client Error", 24 | "stability": 0 25 | }, 26 | { 27 | "name": "5xx", 28 | "description": "The server failed to fulfill an apparently valid request. Server has encountered an error or is otherwise incapable of performing the request. These response codes are applicable to any request method.", 29 | "type": "Server Error", 30 | "stability": 0 31 | } 32 | ] 33 | -------------------------------------------------------------------------------- /src/apis/data/sites.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "HTTP Status Codes", 4 | "description": "http.dev is an easy to reference database of HTTP Status Codes with their definitions and helpful code references all in one place. ", 5 | "url": "https://http.dev/status", 6 | "repo": "" 7 | }, 8 | { 9 | "name": "httpstat.us", 10 | "description": "This is a super simple service for generating different HTTP codes. It's useful for testing how your own scripts deal with varying responses.", 11 | "url": "https://httpstat.us/", 12 | "repo": "" 13 | }, 14 | { 15 | "name": "HTTP Status Map", 16 | "description": "HTTP status codes visualized as a subway map.", 17 | "url": "https://restlet.com/http-status-map/", 18 | "repo": "" 19 | }, 20 | { 21 | "name": "HTTP Cats", 22 | "description": "Status Codes To Cat Memes, as a Service.", 23 | "url": "https://http.cat/", 24 | "repo": "" 25 | }, 26 | { 27 | "name": "HTTP Dogs", 28 | "description": "Status Codes To Dog Memes, as a Service.", 29 | "url": "https://http.dog/", 30 | "repo": "" 31 | }, 32 | { 33 | "name": "HTTP Goats", 34 | "description": "Status Codes To Goat Memes, as a Service.", 35 | "url": "https://httpgoats.com/", 36 | "repo": "" 37 | }, 38 | { 39 | "name": "Web Concepts - HTTP Status Codes", 40 | "description": "HTTP Status Code values found Web Concepts site.", 41 | "url": "http://webconcepts.info/concepts/http-status-code/", 42 | "repo": "" 43 | }, 44 | { 45 | "name": "HTTP Status Code Registry by IANA", 46 | "description": "The official HTTP Status Code registry is maintained by the Internet Assigned Numbers Authority (IANA).", 47 | "url": "http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml", 48 | "repo": "" 49 | }, 50 | { 51 | "name": "REST API Error Codes 101", 52 | "description": "Brief about API error codes", 53 | "url": "https://blog.restcase.com/rest-api-error-codes-101/", 54 | "repo": "", 55 | "blog": true 56 | }, 57 | { 58 | "name": "HTTP Status Codes", 59 | "description": "List of HTTP status codes and description for each of them, with reference.", 60 | "url": "https://github.com/waldemarnt/http-status-codes", 61 | "repo": "https://github.com/waldemarnt/http-status-codes" 62 | }, 63 | { 64 | "name": "HTTP Status cheatsheet", 65 | "description": "HTTP Status cheatsheet. Period.", 66 | "url": "https://devhints.io/http-status", 67 | "repo": "" 68 | } 69 | ] 70 | -------------------------------------------------------------------------------- /src/apis/data/stability.json: -------------------------------------------------------------------------------- 1 | { 2 | "-1": { 3 | "name": "Irrelevant", 4 | "description": "Chances are you can safely ignore these and return a more general status code instead.", 5 | "stability": -1 6 | }, 7 | "0": { 8 | "name": "Standard", 9 | "description": "This is standard API status code. You might probably find these codes all around internet.", 10 | "stability": 0 11 | }, 12 | "1": { 13 | "name": "Useful", 14 | "description": "Returning these wherever appropriate will help anyone who is familiar with HTTP to use website/API and can troubleshoot any issues around this.", 15 | "stability": 1 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/apis/httpInfoApi.js: -------------------------------------------------------------------------------- 1 | import { getHttpCodes, getStabilityCodes, getRelatedSites, gethttpCodeSeries, gethttpCodeSeriesQuestions, getHttpCodeQuestions } from './data'; 2 | 3 | function fetchStabilitySchemas() { 4 | return new Promise(function(resolve, reject) { 5 | resolve(getStabilityCodes()); 6 | }); 7 | } 8 | 9 | function fetchRelatedSitesSchemas() { 10 | return new Promise(function(resolve, reject) { 11 | resolve(getRelatedSites()); 12 | }); 13 | } 14 | 15 | function fetchhttpCodeSeriesSchemas() { 16 | return new Promise(function(resolve, reject) { 17 | resolve(gethttpCodeSeries()); 18 | }); 19 | } 20 | 21 | function fetchHttpCodeSchemas() { 22 | return new Promise(function(resolve, reject) { 23 | resolve(getHttpCodes()); 24 | }); 25 | } 26 | 27 | function fetchHttpCodeQuestions() { 28 | return new Promise(function(resolve, reject) { 29 | resolve(getHttpCodeQuestions()); 30 | }); 31 | } 32 | 33 | function fetchhttpCodeSeriesQuestions() { 34 | return new Promise(function(resolve, reject) { 35 | resolve(gethttpCodeSeriesQuestions()); 36 | }); 37 | } 38 | 39 | export { fetchHttpCodeQuestions, fetchhttpCodeSeriesQuestions, fetchHttpCodeSchemas, fetchhttpCodeSeriesSchemas, fetchStabilitySchemas, fetchRelatedSitesSchemas }; 40 | -------------------------------------------------------------------------------- /src/components/common/contentHeader.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Icon, Grid, Header, Segment } from 'semantic-ui-react'; 3 | 4 | export default function ContentHeader(props) { 5 | const { title, description, icon } = props; 6 | return ( 7 | 8 | 9 | 10 | 11 |
12 | {icon ? : null} 13 | {title} 14 | {description} 15 |
16 |
17 |
18 |
19 |
20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /src/components/common/pageHeader.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Grid, Header, Segment } from 'semantic-ui-react'; 3 | 4 | export default function PageHeader(props) { 5 | const { title } = props; 6 | return ( 7 | 8 | 9 | 10 | 11 |
{title}
12 |
13 |
14 |
15 |
16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /src/components/flow/httpCodeCardList.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import { Card } from 'semantic-ui-react'; 4 | import HttpCodeInfoCard from './httpCodeInfoCard'; 5 | import { ColorMap, IconMap } from '../../constant/params'; 6 | export default function HttpCodeCardList(props) { 7 | const { httpCodeList, currentSeries } = props; 8 | return httpCodeList && httpCodeList.length ? ( 9 | 10 | {httpCodeList.map(httpCode => { 11 | return ; 12 | })} 13 | 14 | ) : null; 15 | } 16 | -------------------------------------------------------------------------------- /src/components/flow/httpCodeInfoCard.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import { Label, Icon, Card } from 'semantic-ui-react'; 4 | 5 | const getContent = (color, icon, httpCode, size) => { 6 | return ( 7 | 11 | ); 12 | }; 13 | 14 | export default function HttpCodeInfoCard({ httpCode, color, icon, size }) { 15 | return ( 16 | 17 | 18 | 19 | {httpCode.more ? ( 20 | 21 | {getContent(color, icon, httpCode, size)} 22 | 23 | ) : ( 24 | getContent(color, icon, httpCode, size) 25 | )} 26 | 27 | 28 | 29 | {`${httpCode.description} `} 30 | {httpCode.more ? ( 31 | 32 | Learn more 33 | 34 | ) : null} 35 | 36 | 37 | 38 | ); 39 | } 40 | -------------------------------------------------------------------------------- /src/components/flow/httpSeriesCardList.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import { Card } from 'semantic-ui-react'; 4 | import HttpSeriesCardMinimal from './httpSeriesCardMinimal'; 5 | export default function HttpSeriesCardList(props) { 6 | const { httpSeriesList, onAction } = props; 7 | return httpSeriesList && httpSeriesList.length ? ( 8 | 9 | {httpSeriesList.map(httpSeries => { 10 | return ; 11 | })} 12 | 13 | ) : null; 14 | } 15 | -------------------------------------------------------------------------------- /src/components/flow/httpSeriesCardMinimal.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import { Label, Icon, Button, Card } from 'semantic-ui-react'; 4 | import { ColorMap, IconMap } from '../../constant/params'; 5 | export default function HttpSeriesCardMinimal(props) { 6 | const { httpSeries, onAction } = props; 7 | return httpSeries ? ( 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | {`${httpSeries.description} `} 19 | {httpSeries.more ? ( 20 | 21 | Learn more 22 | 23 | ) : null} 24 | 25 | 26 | {onAction ? ( 27 | 28 | 20 | ); 21 | })} 22 | 23 | 24 | ) : null; 25 | } 26 | -------------------------------------------------------------------------------- /src/components/layouts/defaultLayout.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { List, Container, Icon, Image, Menu, Segment } from 'semantic-ui-react'; 3 | import logo from '../../static/img/logo.svg'; 4 | const fixed = false; 5 | const footerHeight = '48px'; 6 | const FixedMenuLayout = props => ( 7 | <> 8 |
9 | 10 | 11 | 12 | 21 | 22 | 23 | 28 | 29 | 30 | HTTP Status Codes 31 | 32 | 33 | 34 | Resources 35 | 36 | 37 | 38 | FAQ 39 | 40 | 41 | 42 | 43 |
44 |
45 | {props.children} 46 |
47 |
48 | 49 | 50 | 51 | 52 | 53 | About Me 54 | 55 | 56 | Star on Github 57 | 58 | 59 | 60 | Credits 61 | 62 | 63 | 64 | 65 |
66 | 67 | ); 68 | 69 | export default FixedMenuLayout; 70 | -------------------------------------------------------------------------------- /src/components/motion/ScrollReveal/ScrollReveal.js: -------------------------------------------------------------------------------- 1 | // It doesn't work well if there are multiple instances of ScrollReveal, 2 | // so we have to create a module returning an instance: 3 | // file ScrollReveal.js: 4 | import ScrollReveal from 'scrollreveal'; 5 | export default ScrollReveal(); 6 | -------------------------------------------------------------------------------- /src/components/motion/ScrollReveal/index.js: -------------------------------------------------------------------------------- 1 | import { Component } from 'react'; 2 | import sr from './ScrollReveal'; 3 | 4 | export class Revealer extends Component { 5 | componentDidMount() { 6 | sr.reveal('.animate-from-bottom', { 7 | duration: 1000, 8 | distance: '40px', 9 | easing: 'cubic-bezier(0.5, -0.01, 0, 1.005)', 10 | origin: 'bottom', 11 | interval: 150 12 | }); 13 | 14 | sr.reveal('.animate-from-left', { 15 | duration: 1000, 16 | distance: '40px', 17 | easing: 'cubic-bezier(0.5, -0.01, 0, 1.005)', 18 | origin: 'left', 19 | interval: 150 20 | }); 21 | 22 | sr.reveal('.animate-from-center', { 23 | duration: 1000, 24 | scale: 0.95, 25 | easing: 'cubic-bezier(0.5, -0.01, 0, 1.005)', 26 | interval: 150 27 | }); 28 | 29 | sr.reveal('.animate-ease-in', { 30 | duration: 1000, 31 | scale: 0.95, 32 | easing: 'ease-in', 33 | interval: 150 34 | }); 35 | 36 | sr.reveal('.animate-ease-out', { 37 | duration: 1000, 38 | scale: 0.95, 39 | easing: 'ease-out', 40 | interval: 150 41 | }); 42 | } 43 | render() { 44 | return null; 45 | } 46 | } 47 | 48 | export default Revealer; 49 | -------------------------------------------------------------------------------- /src/constant/params.js: -------------------------------------------------------------------------------- 1 | export const IconMap = { '1xx': 'info', '2xx': 'check', '3xx': 'redo', '4xx': 'computer', '5xx': 'server' }; 2 | export const ColorMap = { '1xx': 'blue', '2xx': 'green', '3xx': 'brown', '4xx': 'orange', '5xx': 'red' }; 3 | -------------------------------------------------------------------------------- /src/constant/routes.js: -------------------------------------------------------------------------------- 1 | class RoutesMapping { 2 | _routes = [ 3 | { path: '/', name: 'Home' }, 4 | { path: '/http-status', exact: true, name: 'httpstatus' }, 5 | { path: '/resource', exact: true, name: 'resource' }, 6 | { path: '/faq', exact: true, name: 'faq' }, 7 | { path: '/credits', exact: true, name: 'credits' }, 8 | { path: '/httpstatusanswer', exact: true, name: 'httpstatusanswer' }, 9 | { path: '/httpcodedetails', exact: true, name: 'httpcodedetails' } 10 | ]; 11 | 12 | getRoutes() { 13 | const routesMap = {}; 14 | this._routes.forEach(function(route) { 15 | let { path, name, exact = false } = route; 16 | routesMap[name.toUpperCase()] = { path, name, exact }; 17 | }); 18 | return routesMap; 19 | } 20 | 21 | /* for future usage */ 22 | 23 | // modifyRoutes(routes){ 24 | // this._routes = routes; 25 | // } 26 | 27 | // addRoute(route){ 28 | // this._routes.push(route); 29 | // } 30 | } 31 | 32 | export default new RoutesMapping(); 33 | export { RoutesMapping }; 34 | -------------------------------------------------------------------------------- /src/containers/FAQ.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "type": "question", 4 | "scheme": { 5 | "heading": "For whom is this tool meant for?", 6 | "content": [ 7 | "This is meant for Restful APIs and system that want to follow standard HTTP status code. One should consider following a specification for better usability across system, providing APIs to third party, disconnecting WEB API server with frontend to understand API response, or simply move ahead with just `200 OK` status across the system with actual reason in body `{ \"status\": \"failure\" }`" 8 | ] 9 | } 10 | }, 11 | { 12 | "type": "question", 13 | "scheme": { 14 | "heading": "Why should any developer use it?", 15 | "content": [ 16 | "There can be a confusion regarding what exact HTTP status code should be for a particular scenario, for eg, should it be `404 Not Found` or `204 No Content` in scenarios where resource exist but has no information. Or should one give `403 Forbidden` for access denied resource and let the user know about existence of the resource (security) or should say `404 Not Found`." 17 | ] 18 | } 19 | }, 20 | { 21 | "type": "question", 22 | "scheme": { 23 | "heading": "Why there is limited set of HTTP Status codes shown on this site?", 24 | "content": ["There are more HTTP status codes for cases which are not considered in this site. For eg, `104` indicated that connection was reset by Peer (server), this is not part of this site. However, status codes that are mentioned in this site should cover about 9/10 use cases for HTTP communication."] 25 | } 26 | }, 27 | { 28 | "type": "question", 29 | "scheme": { 30 | "heading": "I have a bug, feature request, enhancement that can be included in this site, how can I help?", 31 | "content": ["You can create a issue in the Github Repo, and we shall take it forward from there. You can simply visit the repository by clicking on Github icon in the Footer section of the page. "] 32 | } 33 | } 34 | ] 35 | -------------------------------------------------------------------------------- /src/containers/FAQContainer.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { connect } from 'react-redux'; 3 | import { withRouter } from 'react-router'; 4 | import { Grid, Segment } from 'semantic-ui-react'; 5 | import PageHeader from '../components/common/pageHeader'; 6 | import FAQ from './FAQ.json'; 7 | 8 | const mapStateToProps = (state, ownProps) => ({}); 9 | 10 | const mapDispatchToProps = dispatch => ({}); 11 | 12 | class FAQContainer extends Component { 13 | componentDidMount = () => { }; 14 | 15 | render() { 16 | return ( 17 | <> 18 | 19 | 20 | 21 | 22 | 23 | {FAQ.map(f => { 24 | return ( 25 | 26 |

{f.scheme.heading}

27 | {f.scheme.content.map((c, i) => { 28 | return {c}; 29 | })} 30 |
31 | ); 32 | })} 33 |
34 |
35 |
36 |
37 | 38 | ); 39 | } 40 | } 41 | 42 | export default withRouter( 43 | connect( 44 | mapStateToProps, 45 | mapDispatchToProps 46 | )(FAQContainer) 47 | ); 48 | -------------------------------------------------------------------------------- /src/containers/analytics/gaTrackingContainer.js: -------------------------------------------------------------------------------- 1 | import { Component } from 'react'; 2 | import { withRouter } from 'react-router'; 3 | 4 | class GATrackingContainer extends Component { 5 | sendPageView = page => { 6 | // Do nothing if GA was not initialized due to a missing tracking ID. 7 | if (!window.ga) { 8 | return; 9 | } 10 | 11 | // Sets the page value on the tracker. 12 | window.ga('set', 'page', page); 13 | 14 | // Sending the pageview no longer requires passing the page 15 | // value since it's now stored on the tracker object. 16 | window.ga('send', 'pageview'); 17 | }; 18 | 19 | componentDidUpdate = prevProps => { 20 | const currentPage = prevProps.location.pathname + prevProps.location.search; 21 | const nextPage = this.props.location.pathname + this.props.location.search; 22 | 23 | if (currentPage !== nextPage) { 24 | this.sendPageView(nextPage); 25 | } 26 | }; 27 | 28 | render() { 29 | return null; 30 | } 31 | } 32 | 33 | export default withRouter(GATrackingContainer); 34 | -------------------------------------------------------------------------------- /src/containers/appContainer.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Redirect, Route, Switch } from 'react-router-dom'; 3 | import { connect } from 'react-redux'; 4 | import { withRouter } from 'react-router'; 5 | import RoutesMapping from '../constant/routes'; 6 | import 'semantic-ui-css/semantic.min.css'; 7 | import '../static/css/App.css'; 8 | import FixedMenuLayout from '../components/layouts/defaultLayout'; 9 | import ResourceContainer from './resourceContainer'; 10 | import HTTPCodesListContainer from './httpcodesListContainer'; 11 | import FAQContainer from './FAQContainer'; 12 | import { fetchAllHTTPInfo } from '../actions/httpInfoAction'; 13 | import HTTPStatusAnswerContainer from './httpQuestionaire/httpStatusAnswerContainer'; 14 | import CreditsContainer from './creditsContainer'; 15 | import GATrackingContainer from './analytics/gaTrackingContainer'; 16 | import Revealer from '../components/motion/ScrollReveal'; 17 | 18 | const Routes = RoutesMapping.getRoutes(); 19 | 20 | const mapStateToProps = (state, ownProps) => ({}); 21 | 22 | const mapDispatchToProps = dispatch => ({ 23 | fetchAllHTTPInfo: () => { 24 | return dispatch(fetchAllHTTPInfo()); 25 | } 26 | }); 27 | 28 | class AppContainer extends Component { 29 | componentDidMount = () => { 30 | this.props.fetchAllHTTPInfo(); 31 | }; 32 | 33 | render() { 34 | return ( 35 | <> 36 | 37 | 38 | 39 | {/* */} 40 | } /> 41 | } /> 42 | } /> 43 | } /> 44 | } /> 45 | } /> 46 | 47 | 48 | 49 | 50 | 51 | ); 52 | } 53 | } 54 | 55 | export default withRouter( 56 | connect( 57 | mapStateToProps, 58 | mapDispatchToProps 59 | )(AppContainer) 60 | ); 61 | -------------------------------------------------------------------------------- /src/containers/creditsContainer.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { connect } from 'react-redux'; 3 | import { withRouter } from 'react-router'; 4 | import { Icon, Card, Grid, Segment } from 'semantic-ui-react'; 5 | import PageHeader from '../components/common/pageHeader'; 6 | 7 | const mapStateToProps = (state, ownProps) => ({}); 8 | 9 | const mapDispatchToProps = dispatch => ({}); 10 | 11 | class CreditsContainer extends Component { 12 | componentDidMount = () => {}; 13 | 14 | render() { 15 | return ( 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Inspiration 26 | 27 | 28 | Inspired by the phenomenal work on HTTP status code selection by - 29 | 30 | Michael Kropat - Codetinkerer.com 31 | 32 | 33 | 34 | 35 | 36 | 37 | Contributors 38 | 39 | 40 | 41 | Anshul Guleria 42 | 43 |
44 | 45 | Chirag Swadia 46 | 47 |
48 | A big THANK YOU to these wonderful people! 49 |
50 | 51 | 52 | 53 | Attributions 54 | 55 | 56 | 57 | Flaticon 58 | 59 | - for Logo 60 |
61 | 62 | Font Awesome 63 | 64 | - for awesome icons 65 |
66 | 67 | Semantic UI React 68 | 69 | - for Design and Components 70 |
71 | 72 | Netlify 73 | 74 | - for deployment 75 |
76 | 77 | HTTP Status Codes 78 | 79 | - for core content 80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | ); 88 | } 89 | } 90 | 91 | export default withRouter( 92 | connect( 93 | mapStateToProps, 94 | mapDispatchToProps 95 | )(CreditsContainer) 96 | ); 97 | -------------------------------------------------------------------------------- /src/containers/httpQuestionaire/httpStatusAnswerContainer.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { withRouter } from 'react-router'; 3 | import { Step, Icon, Grid, Segment } from 'semantic-ui-react'; 4 | import PageHeader from '../../components/common/pageHeader'; 5 | import HttpStatusSeriesAnswerContainer from './httpStatusSeriesAnswerContainer'; 6 | import HttpStatusCodeAnswerContainer from './httpStatusCodeAnswerContainer'; 7 | import RoutesMapping from '../../constant/routes'; 8 | const Routes = RoutesMapping.getRoutes(); 9 | 10 | class HTTPStatusAnswerContainer extends Component { 11 | switchTab = tabid => { 12 | if (this.props.match.params.tabid !== tabid) { 13 | this.props.history.push(`${Routes.HTTPSTATUSANSWER.path}/${tabid}`); 14 | } 15 | }; 16 | 17 | render() { 18 | const { tabid = 'series' } = this.props.match.params; 19 | 20 | return ( 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | this.switchTab('series')} link> 29 | 30 | 31 | HTTP Status Code Series 32 | Choose HTTP status code series 33 | 34 | 35 | this.switchTab('code')} link> 36 | 37 | 38 | HTTP Status Code 39 | Choose exact HTTP status code 40 | 41 | 42 | 43 | 44 | 45 | 46 | {tabid === 'series' ? : null} 47 | {tabid === 'code' ? : null} 48 | 49 | 50 | ); 51 | } 52 | } 53 | 54 | export default withRouter(HTTPStatusAnswerContainer); 55 | -------------------------------------------------------------------------------- /src/containers/httpQuestionaire/httpStatusCodeAnswerContainer.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { connect } from 'react-redux'; 3 | import { withRouter } from 'react-router'; 4 | import { Header, Icon, Dropdown, Button, Grid, Segment } from 'semantic-ui-react'; 5 | import QuestionComponent from '../../components/flow/questionComponent'; 6 | import HttpCodeCardList from '../../components/flow/httpCodeCardList'; 7 | 8 | import RoutesMapping from '../../constant/routes'; 9 | const Routes = RoutesMapping.getRoutes(); 10 | const mapStateToProps = (state, ownProps) => ({ 11 | httpCodes: state.httpInfo.httpCodes, 12 | httpCodeSeries: state.httpInfo.httpCodeSeries, 13 | httpCodesQuestions: state.httpInfo.questions.httpCodes 14 | }); 15 | 16 | const mapDispatchToProps = dispatch => ({}); 17 | 18 | class HTTPStatusCodeAnswerContainer extends Component { 19 | initialState = { sequence: [0], currentAnswer: [], answered: false, currentIndex: 0 }; 20 | 21 | constructor(props) { 22 | super(props); 23 | this.state = this.initialState; 24 | } 25 | 26 | getHttpSeriesDropDown = () => { 27 | const { httpCodeSeries = [] } = this.props; 28 | 29 | return httpCodeSeries.map(t => { 30 | return { 31 | text: `${t.name} - ${t.type}`, 32 | value: t.name 33 | }; 34 | }); 35 | }; 36 | 37 | onSeriesSelection = (e, d) => { 38 | this.clearState(); 39 | if (this.props.match.params.option !== d.value) { 40 | this.props.history.push(`${Routes.HTTPSTATUSANSWER.path}/${this.props.match.params.tabid}/${d.value}`); 41 | } 42 | }; 43 | 44 | undoQuestion = () => { 45 | const { sequence } = this.state; 46 | const prevQuestion = sequence.pop(); 47 | this.setState({ answered: false, sequence: [...sequence], currentIndex: prevQuestion }); 48 | }; 49 | 50 | clearState = () => { 51 | this.setState(Object.assign({}, this.initialState)); 52 | }; 53 | 54 | onOptionChoose = (question, option) => { 55 | if (option.action.type === 'node') { 56 | this.setState({ answered: true, currentAnswer: option.action.value }); 57 | } 58 | if (option.action.type === 'link') { 59 | this.setState({ currentIndex: option.action.value }); 60 | } 61 | this.setState({ sequence: [...this.state.sequence, question.id] }); 62 | }; 63 | 64 | getSeriesFromAnswer = code => { 65 | return code[0] + 'xx'; 66 | }; 67 | 68 | render() { 69 | const { httpCodesQuestions = {}, httpCodes = {} } = this.props; 70 | const { currentIndex, answered, currentAnswer, sequence } = this.state; 71 | const { option: currentSeries = '' } = this.props.match.params; 72 | 73 | let currentQuestion = {}; 74 | let currentAnswerSeries = ''; 75 | if (currentSeries && httpCodesQuestions[currentSeries]) { 76 | currentQuestion = httpCodesQuestions[currentSeries].find(t => t.id === currentIndex); 77 | } 78 | 79 | if (answered) { 80 | currentAnswerSeries = this.getSeriesFromAnswer(currentAnswer[0]); 81 | } 82 | return ( 83 | 84 | 85 | 86 | 87 | 88 | 89 | {currentSeries ? ( 90 | answered ? ( 91 | 92 | 93 | 94 | 95 | 96 |
97 | 98 | Your Web API should return following status code 99 |
100 |
101 |
102 | 103 | 104 | currentAnswer.includes(t.code.toString()))} /> 105 | 106 | 107 | 108 | 109 |