Skip to content
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

Response header does not reflect the correct version for HTTP2 requests #1689

Closed
2 tasks
piyushgupta243 opened this issue Nov 2, 2021 · 1 comment
Closed
2 tasks

Comments

@piyushgupta243
Copy link

Issue

The response header does not reflect the correct version for HTTP2 requests. Even though, wiremock replies in h2 but the version in the response header shows "HTTP/1.1 200". This is caused by the hardcoded value in the toString() method of Response.java class

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        **sb.append("HTTP/1.1 ")**.append(status).append("\n");
        sb.append(headers).append("\n");
        // no longer printing body
        return sb.toString();
    }

Environment

  • Which version of WireMock you're using -
    2.31.0 standalone

  • How you're starting and configuring WireMock, including configuration or CLI the command line
    Starting wiremock in standalone mode inside a docker container

Steps to reproduce

  1. Insert some request-response data in wiremock
  2. Try to make a request with h2
  3. See the response on the console. You get the response like below for the h2 requests
Response:
HTTP/1.1 200
Content-Type: [application/json]
Matched-Stub-Id: [fc793a71-3651-4c9b-bafd-9678c6265950]
@sunilkumar065
Copy link

Is this fixed in 2.32.0? I tried and below is the reponse

curl --http2 -s -I -X GET http://localhost:8080/api/test
HTTP/1.1 101 Switching Protocols

HTTP/2 200 
matched-stub-id: 908d8b29-fdf2-4d13-9435-240d804d4f02
vary: Accept-Encoding, User-Agent

tomakehurst pushed a commit that referenced this issue Jun 6, 2022
…1890)

* change to be reverted

* remove http protocol hardcoded value in Response.java

* revert readme change

* format the files

* handle review comments

Co-authored-by: poojitha <poojitha.dubba@thoughtworks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants