Skip to content

Commit

Permalink
moved docs to kohttp-jackson
Browse files Browse the repository at this point in the history
  • Loading branch information
rybalkinsd committed Jul 15, 2019
1 parent cf9ce04 commit 6c796d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ import okhttp3.Response
*/
internal val stringMapper: ObjectMapper by lazy { ObjectMapper() }



/**
* Returns Response Body as JSON. If Response is `null` it returns a empty JSON
*
* @return JsonNode.
* @since 0.9.0
* @author gokul
*/
fun Response.asJson(): JsonNode = with(body()?.string()) {
if (isNullOrBlank()) stringMapper.readTree("{}") else stringMapper.readTree(this)
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,6 @@ data class Header(val name: String, val value: String)




/**
* Returns Response Body as JSON.If Response is `null` it returns a empty JSON
*
* @return JsonNode.
* @since 0.9.0
* @author gokul
*/



/**
* Returns Response Body as String.
*
Expand Down

0 comments on commit 6c796d4

Please sign in to comment.