Skip to content

Force client to use the valid schema #1026

Closed
@yindex

Description

@yindex

Is your feature request related to a problem? Please describe.

Yes.

When I use the invalid schema(https, http) with explicit port in uri

//dev config, host=domain:port

String url = String.format("http://%s/%s", host, "websocket");

ws = new WebSocketClient(new URI(url)) 

MayBe, I can't find the potential the problem, because it can run without exception.

But, it will failed when we omit the port in uri. and It will throw an exception:"unkown schema http"

// prod config, host=domain

String url = String.format("http://%s/%s", host, "websocket");

ws = new WebSocketClient(new URI(url)) `

I'm alway frustrated when run failed only with different config in prod environment.

I think we should allow user to find the potential problem during development.

Describe the solution you'd like

always check the schema and throw exception on invalid schema, regardless whether the port is explicit set(no matter uri.getPort() == -1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions