Added http status text to rest response object and fixed tests

This commit is contained in:
Giuseppe
2018-10-11 18:48:27 +02:00
parent 1ee037e031
commit 2baf881f01
33 changed files with 153 additions and 120 deletions

View File

@@ -93,7 +93,7 @@ export class RemoteDataBuildService {
isSuccessful = resEntry.response.isSuccessful;
const errorMessage = isSuccessful === false ? (resEntry.response as ErrorResponse).errorMessage : undefined;
if (hasValue(errorMessage)) {
error = new RemoteDataError(resEntry.response.statusCode.toString(), errorMessage);
error = new RemoteDataError((resEntry.response as ErrorResponse).statusText, errorMessage);
}
}
@@ -226,16 +226,16 @@ export class RemoteDataBuildService {
}).filter((e: string) => hasValue(e))
.join(', ');
const statusCode: string = arr
const statusText: string = arr
.map((d: RemoteData<T>) => d.error)
.map((e: RemoteDataError, idx: number) => {
if (hasValue(e)) {
return `[${idx}]: ${e.statusCode}`;
return `[${idx}]: ${e.statusText}`;
}
}).filter((c: string) => hasValue(c))
.join(', ');
const error = new RemoteDataError(statusCode, errorMessage);
const error = new RemoteDataError(statusText, errorMessage);
const payload: T[] = arr.map((d: RemoteData<T>) => d.payload);