This repository was archived by the owner on Dec 5, 2022. It is now read-only.
Description The type definition for requestFragment does not match the implementation.
It is a single function that takes 5 arguments and returns a promise.
, requestFragment ?: ( filterHeaders : ( attributes : Attributes , req : IncomingMessage ) => object , url : Url , attributes : Attributes , req : IncomingMessage , span ?: Span ) => Promise < ServerResponse >
However, the implementation is a function that takes a single argument, and returns a function that takes 4 arguments and returns a promise.
module . exports = filterHeaders => (
fragmentUrl ,
fragmentAttributes ,
request ,
span = null
) =>
new Promise ( ( resolve , reject ) => {
The response type is ServerResponse, but in on('response', response => ...) is an IncomingMessage
fragmentRequest . on ( 'response' , response => {
if ( response . statusCode >= 500 ) {
reject ( new Error ( 'Internal Server Error' ) ) ;
} else {
resolve ( response ) ;
}
} ) ;
Argument url is an attribute from the tag, and therefore a string, not an instantiated URL object.
https://github.com/atkinchris/tailor/blob/3123dc4d182aef299e7ec1385005cbcf1368134b/lib/fragment.js#L116-L118
I think the correct type definition should be:
( filterHeaders : ( attributes : Attributes , req : IncomingMessage ) => object ) => ( url : string , attributes : Attributes , req : IncomingMessage , span ?: Span ) => Promise < IncomingMessage > Reactions are currently unavailable
The type definition for
requestFragmentdoes not match the implementation.It is a single function that takes 5 arguments and returns a promise.
tailor/index.d.ts
Line 42 in 7283c2f
However, the implementation is a function that takes a single argument, and returns a function that takes 4 arguments and returns a promise.
tailor/lib/request-fragment.js
Lines 26 to 32 in 571b6d5
The response type is
ServerResponse, but inon('response', response => ...)is anIncomingMessagetailor/lib/request-fragment.js
Lines 54 to 60 in 7283c2f
Argument
urlis an attribute from the tag, and therefore astring, not an instantiatedURLobject.https://github.com/atkinchris/tailor/blob/3123dc4d182aef299e7ec1385005cbcf1368134b/lib/fragment.js#L116-L118
I think the correct type definition should be: