Skip to content

Commit

Permalink
✅ Add response.url test
Browse files Browse the repository at this point in the history
  • Loading branch information
kindraywind authored and octto committed Jan 29, 2018
1 parent b6b9e47 commit 49e534e
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions fuel/src/test/kotlin/com/github/kittinunf/fuel/RequestTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,32 @@ class RequestTest : BaseTestCase() {
}()
}

@Test
fun testResponseURLShouldSameWithRequestURL() {
var request: Request? = null
var response: Response? = null
var data: Any? = null
var error: FuelError? = null

manager.request(Method.GET, "http://httpbin.org/get").response { req, res, result ->
request = req
response = res

val (d, err) = result
data = d
error = err
}

assertThat(request, notNullValue())
assertThat(response, notNullValue())
assertThat(error, nullValue())
assertThat(data, notNullValue())

assertThat(request?.url, notNullValue())
assertThat(response?.url, notNullValue())
assertThat(request?.url, isEqualTo(response?.url))
}

@Test
fun httpGetRequestWithDataResponse() {
var request: Request? = null
Expand Down Expand Up @@ -170,15 +196,13 @@ class RequestTest : BaseTestCase() {
fun testProcessBodyWithUnknownContentTypeAndNoData() {
var request: Request? = null
var response: Response? = null
var data: Any? = null
var error: FuelError? = null

manager.request(Method.GET, "http://httpbin.org/bytes/555").responseString { req, res, result ->
request = req
response = res

val (d, err) = result
data = d
error = err
}

Expand Down

0 comments on commit 49e534e

Please sign in to comment.