koa-http-request
Simplified HTTP request for Koa(2.0+).
Install
npm install koa-http-request --save
Usage
const koa = ;const koaRequest = ;const app = ; app; app; app;
Options
json
Type: 'Boolean' Default: false
Parse response body with JSON.parse
and set accept
header to application/json
.
timeout
Type: number
Default: 30000
Milliseconds to wait for a server to send response headers before aborting request with ETIMEDOUT
error.
host
Type: 'String' Default: ''
API
ctx.get(url[, params[, headers]])
ctx.head(url[, params[, headers]])
ctx.post(url[, params[, headers]])
ctx.put(url[, params[, headers]])
ctx.delete(url[, params[, headers]])
License
MIT