\href{https://npmjs.org/package/statuses}{\texttt{ }} \href{https://npmjs.org/package/statuses}{\texttt{ }} \href{https://nodejs.org/en/download}{\texttt{ }} \href{https://travis-ci.org/jshttp/statuses}{\texttt{ }} \href{https://coveralls.io/r/jshttp/statuses?branch=master}{\texttt{ }}

HTTP status utility for node.

This module provides a list of status codes and messages sourced from a few different projects\+:


\begin{DoxyItemize}
\item The \href{https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml}{\texttt{ IANA Status Code Registry}}
\item The \href{https://nodejs.org/}{\texttt{ Node.\+js project}}
\item The \href{https://www.nginx.com/}{\texttt{ NGINX project}}
\item The \href{https://httpd.apache.org/}{\texttt{ Apache HTTP Server project}}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_statuses_README_autotoc_md28898}{}\doxysection{Installation}\label{md_sfcode_node_modules_statuses_README_autotoc_md28898}
This is a \href{https://nodejs.org/en/}{\texttt{ Node.\+js}} module available through the \href{https://www.npmjs.com/}{\texttt{ npm registry}}. Installation is done using the \href{https://docs.npmjs.com/getting-started/installing-npm-packages-locally}{\texttt{ {\ttfamily npm install} command}}\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install statuses }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_statuses_README_autotoc_md28899}{}\doxysection{API}\label{md_sfcode_node_modules_statuses_README_autotoc_md28899}

\begin{DoxyCode}{0}
\DoxyCodeLine{var status = require('statuses') }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_statuses_README_autotoc_md28900}{}\doxysubsection{var code = status(\+Integer $\vert$$\vert$ String)}\label{md_sfcode_node_modules_statuses_README_autotoc_md28900}
If {\ttfamily Integer} or {\ttfamily String} is a valid HTTP code or status message, then the appropriate {\ttfamily code} will be returned. Otherwise, an error will be thrown.


\begin{DoxyCode}{0}
\DoxyCodeLine{status(403) // => 403}
\DoxyCodeLine{status('403') // => 403}
\DoxyCodeLine{status('forbidden') // => 403}
\DoxyCodeLine{status('Forbidden') // => 403}
\DoxyCodeLine{status(306) // throws, as it's not supported by node.js }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_statuses_README_autotoc_md28901}{}\doxysubsection{status.\+STATUS\+\_\+\+CODES}\label{md_sfcode_node_modules_statuses_README_autotoc_md28901}
Returns an object which maps status codes to status messages, in the same format as the \href{https://nodejs.org/dist/latest/docs/api/http.html\#http_http_status_codes}{\texttt{ Node.\+js http module}}.\hypertarget{md_sfcode_node_modules_statuses_README_autotoc_md28902}{}\doxysubsection{status.\+codes}\label{md_sfcode_node_modules_statuses_README_autotoc_md28902}
Returns an array of all the status codes as {\ttfamily Integer}s.\hypertarget{md_sfcode_node_modules_statuses_README_autotoc_md28903}{}\doxysubsection{var msg = status\mbox{[}code\mbox{]}}\label{md_sfcode_node_modules_statuses_README_autotoc_md28903}
Map of {\ttfamily code} to {\ttfamily status message}. {\ttfamily undefined} for invalid {\ttfamily code}s.


\begin{DoxyCode}{0}
\DoxyCodeLine{status[404] // => 'Not Found' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_statuses_README_autotoc_md28904}{}\doxysubsection{var code = status\mbox{[}msg\mbox{]}}\label{md_sfcode_node_modules_statuses_README_autotoc_md28904}
Map of {\ttfamily status message} to {\ttfamily code}. {\ttfamily msg} can either be title-\/cased or lower-\/cased. {\ttfamily undefined} for invalid {\ttfamily status message}s.


\begin{DoxyCode}{0}
\DoxyCodeLine{status['not found'] // => 404}
\DoxyCodeLine{status['Not Found'] // => 404 }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_statuses_README_autotoc_md28905}{}\doxysubsection{status.\+redirect\mbox{[}code\mbox{]}}\label{md_sfcode_node_modules_statuses_README_autotoc_md28905}
Returns {\ttfamily true} if a status code is a valid redirect status.


\begin{DoxyCode}{0}
\DoxyCodeLine{status.redirect[200] // => undefined}
\DoxyCodeLine{status.redirect[301] // => true }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_statuses_README_autotoc_md28906}{}\doxysubsection{status.\+empty\mbox{[}code\mbox{]}}\label{md_sfcode_node_modules_statuses_README_autotoc_md28906}
Returns {\ttfamily true} if a status code expects an empty body.


\begin{DoxyCode}{0}
\DoxyCodeLine{status.empty[200] // => undefined}
\DoxyCodeLine{status.empty[204] // => true}
\DoxyCodeLine{status.empty[304] // => true }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_statuses_README_autotoc_md28907}{}\doxysubsection{status.\+retry\mbox{[}code\mbox{]}}\label{md_sfcode_node_modules_statuses_README_autotoc_md28907}
Returns {\ttfamily true} if you should retry the rest.


\begin{DoxyCode}{0}
\DoxyCodeLine{status.retry[501] // => undefined}
\DoxyCodeLine{status.retry[503] // => true }

\end{DoxyCode}
 