Skip to content
This repository was archived by the owner on Sep 25, 2023. It is now read-only.
This repository was archived by the owner on Sep 25, 2023. It is now read-only.

Support supplying headers in ResponseProvider #13

@bowenwr

Description

@bowenwr

I have a Tyrus based Java websocket client. When attempting to make a connection like:

server.expect().get().withPath("/websocket").andUpgradeToWebSocket().open())

The client throws a handshake exception:

INFO: MockWebServer[57060] received request: GET /websocket HTTP/1.1 and responded: HTTP/1.1 404 Client Error
Apr 17, 2017 5:15:52 PM okhttp3.mockwebserver.MockWebServer$2 acceptConnections
INFO: MockWebServer[57060] done accepting connections: Socket closed

javax.websocket.DeploymentException: Handshake error.

When I attempt to mock out the HTTP side with a 101 response like:

server.expect().withPath("/websocket").andReturn(101, "").always();

It bombs because of a null upgrade header:

Caused by: org.glassfish.tyrus.core.HandshakeException: Invalid Upgrade header value: "null".

I couldn't find any way in ResponseProvider to set headers, only status and body content.

Thanks for a great project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions