Skip to content

Commit fbf3c47

Browse files
authored
Fix client data checker return (#71)
1 parent 2ff075c commit fbf3c47

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/connection/httpClient.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ export const httpClient = (config: ConnectionParams): HttpClient => {
129129

130130
const makeUrl = (basePath: string) => (path: string) => basePath + path;
131131

132-
const makeCheckStatus = (expectResponseBody: any) => (res: any) => {
132+
const makeCheckStatus = (expectResponseBody: boolean) => (res: Response) => {
133133
if (res.status >= 400) {
134-
return res.text().then((errText: any) => {
135-
let err;
134+
return res.text().then((errText: string) => {
135+
let err: string;
136136
try {
137137
// in case of invalid json response (like empty string)
138138
err = JSON.stringify(JSON.parse(errText));
@@ -148,11 +148,11 @@ const makeCheckStatus = (expectResponseBody: any) => (res: any) => {
148148
}
149149
};
150150

151-
const handleHeadResponse = (expectResponseBody: any) => (res: any) => {
151+
const handleHeadResponse = (expectResponseBody: boolean) => (res: Response) => {
152152
if (res.status == 204 || res.status == 404) {
153153
return res.status == 204;
154154
}
155-
return makeCheckStatus(expectResponseBody);
155+
return makeCheckStatus(expectResponseBody)(res);
156156
};
157157

158158
function addAuthHeaderIfNeeded(request: any, bearerToken: string) {

0 commit comments

Comments
 (0)