New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FakeRequest incorrectly uses request body as response body #47

Closed
carlosmiranda opened this Issue Jul 18, 2014 · 11 comments

Comments

Projects
None yet
4 participants
@carlosmiranda
Contributor

carlosmiranda commented Jul 18, 2014

When the RequestBody of a FakeRequest is set, it incorrectly uses it in the body of the ResponseBody instead of using the response body content that was specified.

For example, the following test will fail:

@Test
public void fakeRequestReturnsRequestBody() throws Exception {
    MatcherAssert.assertThat(
        new FakeRequest()
            .withBody("foo")  // Response body - should be returned
            .body().set("bar").back() // Request body
            .fetch().body(),
        Matchers.is("foo")
    );
}

Error:

java.lang.AssertionError: 
Expected: is "foo"
     but: was "bar"

Note that the following test - if the RequestBody is not set - works fine:

@Test
public void fakeRequestReturnsRequestBody() throws Exception {
    MatcherAssert.assertThat(
        new FakeRequest()
            .withBody("foo")
            .fetch().body(),
        Matchers.is("foo")
    );
}
@dmarkov

This comment has been minimized.

Show comment
Hide comment
@dmarkov

dmarkov Jul 18, 2014

we'll find someone to do this task, soon

dmarkov commented Jul 18, 2014

we'll find someone to do this task, soon

@dmarkov

This comment has been minimized.

Show comment
Hide comment
@dmarkov

dmarkov Jul 18, 2014

thank you for the ticket reported, I topped your account for 15 mins, transaction 42127672

dmarkov commented Jul 18, 2014

thank you for the ticket reported, I topped your account for 15 mins, transaction 42127672

@carlosmiranda

This comment has been minimized.

Show comment
Hide comment
@carlosmiranda

carlosmiranda Jul 22, 2014

Contributor

@dmarkov @yegor256 can I work on this?

Contributor

carlosmiranda commented Jul 22, 2014

@dmarkov @yegor256 can I work on this?

@yegor256

This comment has been minimized.

Show comment
Hide comment
@yegor256

yegor256 Jul 22, 2014

Member

@dmarkov please assign @carlosmiranda to this task

Member

yegor256 commented Jul 22, 2014

@dmarkov please assign @carlosmiranda to this task

@dmarkov

This comment has been minimized.

Show comment
Hide comment
@dmarkov

dmarkov Jul 22, 2014

@dmarkov please assign @carlosmiranda to this task

@yegor256 yep, done. @carlosmiranda it's your task now

dmarkov commented Jul 22, 2014

@dmarkov please assign @carlosmiranda to this task

@yegor256 yep, done. @carlosmiranda it's your task now

carlosmiranda added a commit to carlosmiranda/jcabi-http that referenced this issue Jul 23, 2014

carlosmiranda added a commit to carlosmiranda/jcabi-http that referenced this issue Jul 23, 2014

@carlosmiranda

This comment has been minimized.

Show comment
Hide comment
@carlosmiranda

carlosmiranda Jul 23, 2014

Contributor

Pull request created at #48.

Contributor

carlosmiranda commented Jul 23, 2014

Pull request created at #48.

@carlosmiranda

This comment has been minimized.

Show comment
Hide comment
@carlosmiranda

carlosmiranda Jul 23, 2014

Contributor

Fixed in #48.

Contributor

carlosmiranda commented Jul 23, 2014

Fixed in #48.

@dmarkov

This comment has been minimized.

Show comment
Hide comment
@dmarkov

dmarkov Jul 25, 2014

@carlosmiranda Many thanks! 30 mins were added to your account in Transaction ID 42406825

dmarkov commented Jul 25, 2014

@carlosmiranda Many thanks! 30 mins were added to your account in Transaction ID 42406825

@yegor256

This comment has been minimized.

Show comment
Hide comment
@yegor256

yegor256 Jul 27, 2014

Member

@rultor please release, tag is 1.8.1

Member

yegor256 commented Jul 27, 2014

@rultor please release, tag is 1.8.1

@rultor

This comment has been minimized.

Show comment
Hide comment
@rultor

rultor Jul 27, 2014

Contributor

@rultor please release, tag is 1.8.1

@yegor256 OK, I will release it now. Please check the progress here

Contributor

rultor commented Jul 27, 2014

@rultor please release, tag is 1.8.1

@yegor256 OK, I will release it now. Please check the progress here

@rultor

This comment has been minimized.

Show comment
Hide comment
@rultor

rultor Jul 27, 2014

Contributor

@rultor please release, tag is 1.8.1

@yegor256 Done! FYI, the full log is here (took me 9min)

Contributor

rultor commented Jul 27, 2014

@rultor please release, tag is 1.8.1

@yegor256 Done! FYI, the full log is here (took me 9min)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment