@curveball/core
Advanced tools
Comparing version 0.16.2 to 0.16.3
Changelog | ||
========= | ||
0.16.3 (2021-05-06) | ||
------------------- | ||
* Updated lint rules | ||
* Make file update | ||
* Updated dependencies | ||
0.16.2 (2021-02-18) | ||
@@ -5,0 +12,0 @@ ------------------- |
@@ -44,3 +44,3 @@ "use strict"; | ||
function isMiddlewareObject(input) { | ||
return (input[middlewareCall] !== undefined); | ||
return input[middlewareCall] !== undefined; | ||
} | ||
@@ -47,0 +47,0 @@ class Application extends events_1.EventEmitter { |
@@ -10,3 +10,3 @@ "use strict"; | ||
super(method, requestTarget); | ||
if (headers && headers.get !== undefined) { | ||
if ((headers === null || headers === void 0 ? void 0 : headers.get) !== undefined) { | ||
this.headers = headers; | ||
@@ -13,0 +13,0 @@ } |
{ | ||
"name": "@curveball/core", | ||
"version": "0.16.2", | ||
"version": "0.16.3", | ||
"description": "Curveball is a framework writting in Typescript for Node.js", | ||
@@ -40,3 +40,3 @@ "main": "dist/index.js", | ||
"@types/mocha": "^8.2.1", | ||
"@types/node": "^12.20.2", | ||
"@types/node": "^12.20.12", | ||
"@types/node-fetch": "^2.5.8", | ||
@@ -62,3 +62,3 @@ "@types/sinon": "^9.0.10", | ||
"dependencies": { | ||
"@curveball/http-errors": "^0.3.0", | ||
"@curveball/http-errors": "^0.4.0", | ||
"@types/ws": "^7.2.9", | ||
@@ -65,0 +65,0 @@ "accepts": "^1.3.7", |
@@ -82,3 +82,3 @@ Curveball | ||
Curveball allows you do do an internal request with 'mock' request and | ||
Curveball allows you to do an internal request with 'mock' request and | ||
response objects. | ||
@@ -85,0 +85,0 @@ |
@@ -44,3 +44,3 @@ import { isHttpError } from '@curveball/http-errors'; | ||
type MiddlewareObject = { | ||
[middlewareCall]: MiddlewareFunction | ||
[middlewareCall]: MiddlewareFunction; | ||
}; | ||
@@ -62,3 +62,3 @@ | ||
if (isMiddlewareObject(mw)) { | ||
mwFunc = (<MiddlewareObject> mw)[middlewareCall].bind(fns[0]); | ||
mwFunc = mw[middlewareCall].bind(fns[0]); | ||
} else { | ||
@@ -74,3 +74,3 @@ mwFunc = mw; | ||
function isMiddlewareObject(input: Middleware): input is MiddlewareObject { | ||
return ((<MiddlewareObject> input)[middlewareCall] !== undefined); | ||
return (input as MiddlewareObject)[middlewareCall] !== undefined; | ||
} | ||
@@ -203,5 +203,5 @@ | ||
if (typeof arg1 === 'string') { | ||
request = new MemoryRequest(<string> arg1, path!, headers, body); | ||
request = new MemoryRequest(arg1, path!, headers, body); | ||
} else { | ||
request = <Request> arg1; | ||
request = arg1; | ||
} | ||
@@ -208,0 +208,0 @@ |
@@ -35,3 +35,3 @@ import { Middleware } from './application'; | ||
state: { | ||
[s: string]: any | ||
[s: string]: any; | ||
}; | ||
@@ -157,4 +157,4 @@ | ||
if ((<any> this.request).ip !== undefined) { | ||
return (<any> this.request).ip(trustProxy); | ||
if ((this.request as any).ip !== undefined) { | ||
return (this.request as any).ip(trustProxy); | ||
} | ||
@@ -161,0 +161,0 @@ return null; |
@@ -29,3 +29,3 @@ import { Middleware } from './application'; | ||
state: { | ||
[s: string]: any | ||
[s: string]: any; | ||
}; | ||
@@ -114,3 +114,3 @@ | ||
*/ | ||
webSocket?: WebSocket | ||
webSocket?: WebSocket; | ||
} | ||
@@ -131,4 +131,4 @@ | ||
*/ | ||
webSocket: WebSocket | ||
webSocket: WebSocket; | ||
} |
@@ -60,3 +60,3 @@ /** | ||
export type HeadersObject = { | ||
[headerName: string]: string | string[] | number | ||
[headerName: string]: string | string[] | number; | ||
}; | ||
@@ -67,3 +67,3 @@ | ||
private store: { | ||
[name: string]: [string, string | string[] | number] | ||
[name: string]: [string, string | string[] | number]; | ||
}; | ||
@@ -176,4 +176,4 @@ | ||
const oldArray: string[] = Array.isArray(this.store[lowerName][1]) ? <string[]> this.store[lowerName][1] : [this.store[lowerName][1].toString()]; | ||
this.store[lowerName][1] = oldArray.concat(<string|string[]> value); | ||
const oldArray: string[] = Array.isArray(this.store[lowerName][1]) ? this.store[lowerName][1] as string[] : [this.store[lowerName][1].toString()]; | ||
this.store[lowerName][1] = oldArray.concat(value as string[]|string); | ||
@@ -180,0 +180,0 @@ } |
@@ -21,6 +21,6 @@ import { Readable } from 'stream'; | ||
super(method, requestTarget); | ||
if (headers && (<HeadersInterface> headers).get !== undefined) { | ||
this.headers = <HeadersInterface> headers; | ||
if (headers?.get !== undefined) { | ||
this.headers = headers as HeadersInterface; | ||
} else { | ||
this.headers = new Headers(<HeadersObject> headers); | ||
this.headers = new Headers(headers as HeadersObject); | ||
} | ||
@@ -27,0 +27,0 @@ this.originalBody = body; |
@@ -21,3 +21,3 @@ import * as http from 'http'; | ||
return (<http2.Http2ServerResponse> response).stream !== undefined; | ||
return (response as http2.Http2ServerResponse).stream !== undefined; | ||
@@ -24,0 +24,0 @@ } |
@@ -41,5 +41,5 @@ import * as rawBody from 'raw-body'; | ||
const options: { | ||
encoding?: string, | ||
limit?: string, | ||
length?: string | ||
encoding?: string; | ||
limit?: string; | ||
length?: string; | ||
} = {}; | ||
@@ -46,0 +46,0 @@ if (limit) { |
@@ -112,3 +112,3 @@ import { HeadersInterface, HeadersObject } from '../headers'; | ||
} | ||
this.inner.setHeader(name, oldValue.concat(<string|string[]> value)); | ||
this.inner.setHeader(name, oldValue.concat(value as string[]|string)); | ||
@@ -115,0 +115,0 @@ } |
@@ -93,6 +93,6 @@ import * as http from 'http'; | ||
if (typeof headers !== 'undefined') { | ||
if ((<HeadersInterface> headers).getAll !== undefined) { | ||
outHeaders = (<HeadersInterface> headers).getAll(); | ||
if (headers.getAll !== undefined) { | ||
outHeaders = (headers as HeadersInterface).getAll(); | ||
} else { | ||
outHeaders = <HeadersObject> headers; | ||
outHeaders = headers as HeadersObject; | ||
} | ||
@@ -99,0 +99,0 @@ } |
@@ -109,3 +109,3 @@ import * as accepts from 'accepts'; | ||
return <any> url.parse(this.requestTarget, true).query; | ||
return url.parse(this.requestTarget, true).query as any; | ||
@@ -149,3 +149,3 @@ } | ||
const result = <string|false> accepts(<http.IncomingMessage> mockRequestObj).type(types); | ||
const result = accepts(mockRequestObj as http.IncomingMessage).type(types) as string|false; | ||
return result === false ? null : result; | ||
@@ -152,0 +152,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
173007
+ Added@curveball/http-errors@0.4.1(transitive)
- Removed@curveball/http-errors@0.3.0(transitive)