Skip to content

Commit

Permalink
[kotlin] Fix NPE for POST/PUT/PATCH with empty request models. (#7629)
Browse files Browse the repository at this point in the history
* [kotlin] Fix NPE for POST/PUT/PATCH with empty request models.

* [kotlin] Pass content type in empty response as discussed in PR review.
  • Loading branch information
kgilmer authored and wing328 committed Feb 18, 2018
1 parent 9fb2c29 commit 39fa375
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ open class ApiClient(val baseUrl: String) {
RequestMethod.DELETE -> Request.Builder().url(url).delete()
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body!!, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body!!, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body!!, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ open class ApiClient(val baseUrl: String) {
RequestMethod.DELETE -> Request.Builder().url(url).delete()
RequestMethod.GET -> Request.Builder().url(url)
RequestMethod.HEAD -> Request.Builder().url(url).head()
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body!!, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body!!, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body!!, contentType))
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
}

Expand Down

0 comments on commit 39fa375

Please sign in to comment.