fix: properly handle http error status codes

fix #941
This commit is contained in:
Tom Kirkpatrick 2019-07-08 20:15:57 +02:00
parent c94d1438bb
commit aa54122e51
No known key found for this signature in database
GPG Key ID: 72203A8EC5967EA8
1 changed files with 9 additions and 9 deletions

View File

@ -243,24 +243,24 @@ export class Http2CallStream extends Duplex implements Call {
} else {
this.http2Stream = stream;
stream.on('response', (headers, flags) => {
switch (headers[HTTP2_HEADER_STATUS]) {
switch (headers[':status']) {
// TODO(murgatroid99): handle 100 and 101
case '400':
case 400:
this.mappedStatusCode = Status.INTERNAL;
break;
case '401':
case 401:
this.mappedStatusCode = Status.UNAUTHENTICATED;
break;
case '403':
case 403:
this.mappedStatusCode = Status.PERMISSION_DENIED;
break;
case '404':
case 404:
this.mappedStatusCode = Status.UNIMPLEMENTED;
break;
case '429':
case '502':
case '503':
case '504':
case 429:
case 502:
case 503:
case 504:
this.mappedStatusCode = Status.UNAVAILABLE;
break;
default: