Comparing version 0.3.0 to 0.3.1
/// <reference types="node" /> | ||
import { IncomingMessage, ServerResponse } from "http"; | ||
import { IncomingMessage, ServerResponse, Server } from "http"; | ||
import { AxiosAdapter, AxiosInstance } from "axios"; | ||
declare type RequestListener = (request: IncomingMessage, response: ServerResponse) => void; | ||
declare const createAdapter: (callback: RequestListener) => AxiosAdapter; | ||
declare const axiosist: (callback: RequestListener) => AxiosInstance; | ||
declare const axiosist: (callback: RequestListener | Server) => AxiosInstance; | ||
export { createAdapter }; | ||
export default axiosist; |
@@ -24,3 +24,3 @@ 'use strict' | ||
const server = http.createServer(callback) | ||
const server = typeof callback === 'function' ? http.createServer(callback) : callback | ||
@@ -27,0 +27,0 @@ return new Promise((resolve, reject) => { |
{ | ||
"name": "axiosist", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Convert node.js request handler to axios adapter", | ||
@@ -28,2 +28,5 @@ "main": "index.js", | ||
"homepage": "https://github.com/Gerhut/axiosist#readme", | ||
"engines": { | ||
"node": ">=6.9.0" | ||
}, | ||
"dependencies": { | ||
@@ -33,3 +36,3 @@ "axios": "^0.18.0" | ||
"devDependencies": { | ||
"@types/node": "^10.11.7", | ||
"@types/node": ">=6.9.0", | ||
"ava": "^1.0.1", | ||
@@ -36,0 +39,0 @@ "nyc": "^13.0.1", |
import test from 'ava' | ||
import * as http from 'http' | ||
import axiosist from '.' | ||
@@ -94,1 +95,9 @@ | ||
})) | ||
test('should work with http server', t => { | ||
const app = http.createServer((req, res) => { | ||
res.end('foo') | ||
}) | ||
return axiosist(app).get('/').then(() => t.pass()) | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10167
151
2