mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-28 20:37:38 +00:00
Add support for HTTP timeouts (#1453)
- Add a `timeout` parameter to http request and websocket methods.
- For requests, this sets the connection and read timeout.
- For websockets, this sets the connection and handshake timeout.
- Remove the timeout config option, as this is now specified by user
code.
- Use netty for handling websocket handshakes, meaning we no longer
need to deal with pongs.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
package http
|
||||
|
||||
import dan200.computercraft.api.lua.ObjectArguments
|
||||
import dan200.computercraft.core.CoreConfig
|
||||
import dan200.computercraft.core.apis.HTTPAPI
|
||||
import dan200.computercraft.core.apis.http.options.Action
|
||||
@@ -45,7 +46,7 @@ class TestHttpApi {
|
||||
LuaTaskRunner.runTest {
|
||||
val httpApi = addApi(HTTPAPI(environment))
|
||||
|
||||
val result = httpApi.websocket(WS_ADDRESS, Optional.empty())
|
||||
val result = httpApi.websocket(ObjectArguments(WS_ADDRESS))
|
||||
assertArrayEquals(arrayOf(true), result, "Should have created websocket")
|
||||
|
||||
val event = pullEvent()
|
||||
|
||||
Reference in New Issue
Block a user