httpproblem
Advanced tools
Comparing version 0.5.2 to 0.5.3
{ | ||
"name": "httpproblem", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "Create Problem Details for HTTP APIs according to RFC 7807", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,5 +8,11 @@ # Create problem+json documents with Node.js | ||
``` | ||
npm install --save-dev httpproblem | ||
npm install --save httpproblem | ||
``` | ||
or | ||
``` | ||
yarn add httpproblem | ||
``` | ||
## Usage | ||
@@ -81,2 +87,21 @@ | ||
### StatusCodeProblems | ||
`httpproblem` also provides some default problems for HTTP Status Codes you can just create without providing further details. | ||
The supported `StatusCodeProblems` you can create, are: | ||
- BadRequestProblem | ||
- UnauthorizedProblem | ||
- ForbiddenProblem, | ||
- NotFoundProblem, | ||
- InternalServerErrorProblem | ||
Instances can be created like this: | ||
```js | ||
const httpProblem = require('httpproblem'); | ||
const UnauthorizedProblem new httpProblem.StatusCodeProblems.UnauthorizedProblem(); | ||
``` | ||
## Running the tests | ||
@@ -104,3 +129,3 @@ | ||
Copyright (c) 2017 PDMLab | ||
Copyright (c) 2017 - 2019 PDMLab | ||
@@ -107,0 +132,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
Sorry, the diff of this file is not supported yet
90476
146