@@ -3,10 +3,10 @@ import {
33 ClientRequest ,
44 ClientRequestArgs ,
55 IncomingMessage ,
6- request as httpRequest
6+ request as httpRequest ,
77} from "http" ;
88import { Agent as HttpsAgent , request as httpsRequest } from "https" ;
9- import { parse as parseUrl , Url } from "url" ;
9+ import { parse as parseUrl } from "url" ;
1010import { btoa } from "./btoa" ;
1111import { joinPath } from "./joinPath" ;
1212import { Errback } from "./types" ;
@@ -23,7 +23,7 @@ export type ArangojsError = Error & {
2323
2424export interface RequestOptions {
2525 method : string ;
26- url : Url ;
26+ url : { pathname : string ; search ?: string } ;
2727 headers : { [ key : string ] : string } ;
2828 body : any ;
2929 expectBinary : boolean ;
@@ -57,10 +57,10 @@ export function createRequest(
5757 const i = baseUrlParts . pathname . indexOf ( ":" ) ;
5858 if ( i === - 1 ) {
5959 socketPath = baseUrlParts . pathname ;
60- baseUrlParts . pathname = undefined ;
60+ baseUrlParts . pathname = null ;
6161 } else {
6262 socketPath = baseUrlParts . pathname . slice ( 0 , i ) ;
63- baseUrlParts . pathname = baseUrlParts . pathname . slice ( i + 1 ) || undefined ;
63+ baseUrlParts . pathname = baseUrlParts . pathname . slice ( i + 1 ) || null ;
6464 }
6565 }
6666 if ( socketPath && ! socketPath . replace ( / \/ / g, "" ) . length ) {
@@ -107,7 +107,7 @@ export function createRequest(
107107 options ,
108108 ( res : IncomingMessage ) => {
109109 const data : Buffer [ ] = [ ] ;
110- res . on ( "data" , chunk => data . push ( chunk as Buffer ) ) ;
110+ res . on ( "data" , ( chunk ) => data . push ( chunk as Buffer ) ) ;
111111 res . on ( "end" , ( ) => {
112112 const result = res as ArangojsResponse ;
113113 result . request = req ;
@@ -124,7 +124,7 @@ export function createRequest(
124124 req . on ( "timeout" , ( ) => {
125125 req . abort ( ) ;
126126 } ) ;
127- req . on ( "error" , err => {
127+ req . on ( "error" , ( err ) => {
128128 const error = err as ArangojsError ;
129129 error . request = req ;
130130 if ( called ) return ;
@@ -138,13 +138,13 @@ export function createRequest(
138138 called = true ;
139139 setTimeout ( ( ) => {
140140 callback ( e ) ;
141- } ) ;
141+ } , 0 ) ;
142142 }
143143 } ,
144144 {
145145 close ( ) {
146146 agent . destroy ( ) ;
147- }
147+ } ,
148148 }
149149 ) ;
150150}
0 commit comments