Allow trailing space in ENSO_HTTP_TEST_HTTPBIN_URL URL. (#3500)

This commit is contained in:
Michał Wawrzyniec Urbańczyk 2022-06-01 09:32:03 +02:00 committed by GitHub
parent 33a06c9ddf
commit 9842b0e5f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -3,4 +3,4 @@ This is a set of tests for the `Base` library for Enso.
The run test suite for the HTTP component requires an active `httbin` server on
the localhost. If it is present, the port it listens to should be provided by
setting the `ENSO_HTTP_TEST_HTTPBIN_URL` environment variable to a value like
`http://localhost:8080`. The URL should not contain a trailing slash.
`http://localhost:8080`. The URL may contain a trailing slash.

View File

@ -23,8 +23,12 @@ spec =
The HTTP tests only run when the `ENSO_HTTP_TEST_HTTPBIN_URL` environment variable is set to URL of the httpbin server
Test.group "Http" pending=pending <|
url_get = base_url + "/get"
url_post = base_url + "/post"
# httpbin is picky about slashes in URL path. We need exactly one at the
# beginning of path. Otherwise, POST request with double slash would
# fail with error 405.
base_url_with_slash = if base_url.ends_with "/" then base_url else base_url + "/"
url_get = base_url_with_slash + "get"
url_post = base_url_with_slash + "post"
Test.specify "should create HTTP client with timeout setting" <|
http = Http.new (timeout = 30.seconds)
http.timeout.should_equal 30.seconds