Skip to content

Commit

Permalink
fix(#74): added test to demonstrate the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
albertocsouto committed Jun 6, 2024
1 parent 0dac504 commit 7d564bc
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/erf_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,16 @@ statics(_Conf) ->
)
),

?assertMatch(
{ok, {{"HTTP/1.1", 206, "Partial Content"}, _ResultHeaders, <<"{">>}},
httpc:request(
get,
{"http://localhost:8789/static/test%20with%20spaces.json", [{"range", "bytes=0-0"}]},
[],
[{body_format, binary}]
)
),

ok = erf:stop(erf_server),

ok.
Expand Down
84 changes: 84 additions & 0 deletions test/fixtures/test with spaces.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "With refs",
"license": {
"name": "Apache 2.0"
}
},
"paths": {
"/{version}/foo":{
"parameters":[
{"$ref": "common_oas_3_0_spec.json#/components/parameters/Version"}
],
"get":{
"summary":"Get foo",
"operationId":"getFoo",
"parameters": [
{"$ref": "common_oas_3_0_spec.json#/components/parameters/Enabled"}
],
"responses":{
"200":{
"description":"OK",
"content":{
"application/json":{
"schema":{
"$ref":"common_oas_3_0_spec.json#/components/schemas/Foo"
}
}
}
},
"404": {
"$ref": "common_oas_3_0_spec.json#/components/responses/NotFound"
}
}
},
"post": {
"summary": "Create foo",
"operationId": "createFoo",
"requestBody": {
"$ref": "common_oas_3_0_spec.json#/components/requestBodies/PostFoo"
},
"responses": {
"201": {
"description": "Created",
"content": {
"application/json": {
"schema": {
"$ref": "common_oas_3_0_spec.json#/components/schemas/Foo"
}
}
}
}
}
}
},
"/{version}/foo/{id}": {
"parameters": [
{"$ref": "common_oas_3_0_spec.json#/components/parameters/Version"},
{
"in": "path",
"name": "id",
"schema": {
"type": "string"
},
"required": true,
"description": "Foo's identifier"
}
],
"delete": {
"summary": "Delete foo",
"operationId": "deleteFoo",
"responses": {
"204": {
"$ref": "common_oas_3_0_spec.json#/components/responses/NoContent"
},
"404": {
"$ref": "common_oas_3_0_spec.json#/components/responses/NotFound"
}
}
}
}
}
}

0 comments on commit 7d564bc

Please sign in to comment.