mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(core): return XML error for missing action and add volume action fallbacks (#1348)
This commit addresses the XML parser error on clients when requests are made without the 'Action' parameter. Previously, it returned a 204 No Content response with an empty body; now it returns a 400 Bad Request status and a structured XML 'MissingAction' error. It also adds missing EC2 volume actions ('CreateVolume', 'DescribeVolumes', 'DeleteVolume') to the unauthenticated fallback list in the query controller.
Closes #1333
This commit is contained in:
1 parent
57d9ef5ad8
commit
1a42aafcfb
2 files changed
+42
-2
No files matched your search
+38
@@ -0,0 +1,38 @@
|
||||
package io.github.hectorvent.floci.core.common;
|
||||
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
|
||||
@QuarkusTest
|
||||
class AwsQueryControllerIntegrationTest {
|
||||
|
||||
@Test
|
||||
void missingActionParameterReturns400MissingAction() {
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.contentType("application/xml")
|
||||
.body("ErrorResponse.Error.Code", equalTo("MissingAction"))
|
||||
.body("ErrorResponse.Error.Message", equalTo("The request must contain the parameter Action"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void ec2ActionFallbackWithoutAuthorizationHeader() {
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.formParam("Action", "DescribeRegions")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.contentType("application/xml")
|
||||
.body("DescribeRegionsResponse.regionInfo.item.size()", greaterThan(0));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user