Committed by
GitHub
Merge pull request #907 from eduardoflorence/getconnect-api-without-body
Handles Response when there is no content-type and body
Showing
2 changed files
with
4 additions
and
2 deletions
| @@ -56,7 +56,7 @@ class HttpRequestImpl extends HttpRequestBase { | @@ -56,7 +56,7 @@ class HttpRequestImpl extends HttpRequestBase { | ||
| 56 | final body = bodyDecoded<T>( | 56 | final body = bodyDecoded<T>( |
| 57 | request, | 57 | request, |
| 58 | stringBody, | 58 | stringBody, |
| 59 | - response.headers.contentType.mimeType, | 59 | + response.headers.contentType?.mimeType, |
| 60 | ); | 60 | ); |
| 61 | 61 | ||
| 62 | return Response( | 62 | return Response( |
| @@ -20,7 +20,9 @@ T bodyDecoded<T>(Request<T> request, String stringBody, String mimeType) { | @@ -20,7 +20,9 @@ T bodyDecoded<T>(Request<T> request, String stringBody, String mimeType) { | ||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | try { | 22 | try { |
| 23 | - if (request.decoder == null) { | 23 | + if (stringBody == '') { |
| 24 | + body = null; | ||
| 25 | + } else if (request.decoder == null) { | ||
| 24 | body = bodyToDecode as T; | 26 | body = bodyToDecode as T; |
| 25 | } else { | 27 | } else { |
| 26 | body = request.decoder(bodyToDecode); | 28 | body = request.decoder(bodyToDecode); |
-
Please register or login to post a comment