Hello, I’ve migration of my project to Gatling 3.0, but faced with the problem while opening a websocket in code like this:
`
class ConnectSimulation extends Simulation {
val wsUrl = "ws://localhost:8008"
val wsConfig: HttpProtocolBuilder = http.wsBaseUrl(wsUrl)
val scn: ScenarioBuilder = scenario("Connection test").repeat(1) {
exec(ws("Open Socket").connect(wsUrl))
}
setUp(
scn.inject(atOnceUsers(1)).protocols(wsConfig)
).maxDuration(10.seconds)
}
`
When gatling sends HTTP handshake request for opening a websocket, server refuses the connection with error code 400.
`
GET / HTTP/1.1
accept: */*
origin: http://localhost:8008
upgrade: websocket
connection: upgrade
sec-websocket-key: cV1C+6FK0GQslEA+0G4vmA==
host: localhost:8008
sec-websocket-origin: http://localhost:8008
sec-websocket-version: 13
HTTP/1.1 400 Bad Request
Server: fasthttp
Content-Type: text/plain; charset=utf-8
Content-Length: 64
`
The same code like in program above for Gatling version 2.3 returns:
`
Request DefaultFullHttpRequest(decodeResult: success, version: HTTP/1.1, content: EmptyByteBufBE)
GET / HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Key: mqV2A6yTtYMbFuc5CwdPuA==
Sec-WebSocket-Version: 13
Origin: http://localhost:8008
Host: localhost:8008
Accept: /
Response DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 101 SwitchingProtocols
Server: fasthttp
Upgrade: websocket
Connection: Upgrade
Sec-Websocket-Accept: n58uYR0L4TFCdEF2Xta+YZf+bUE=
`
The main difference in requests headers is that first letter of сonnection header value is capital in Gatling version 2.3 while in gatling 3.0 it’s lowercase.
That is the main problem. Server which I’m trying to connect accepts request only if connection header value starts with capital letter: “Upgrade”
I don’t have access to the server and can’t make any changes on server side.
Is there any ways to override connection header value to make that first letter capitalized?
Or may be there are some workarounds that allows me to collect a simple HTTP request by myself and after that work with that websocket session?