Skip to content

Commit

Permalink
make sure we format the response as json when status is 202, fixes Hy…
Browse files Browse the repository at this point in the history
  • Loading branch information
stalep committed Feb 6, 2025
1 parent c11e9a4 commit d3e4949
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/site/content/en/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ paths:
\ of created run IDs if available, or an empty list if processing is still\
\ ongoing. Label values and change detection processing is performed asynchronously."
content:
text/plain:
application/json:
schema:
type: string
example: "101,102,103"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Response add(@QueryParam("test") String testNameOrId,
@APIResponses(value = {
@APIResponse(responseCode = "202", description = "The request has been accepted for processing. Returns a list of created run IDs if available, "
+ "or an empty list if processing is still ongoing. Label values and change detection processing " +
"is performed asynchronously.", content = @Content(mediaType = MediaType.TEXT_PLAIN, schema = @Schema(type = SchemaType.STRING, example = "101,102,103"), example = "101,102,103")),
"is performed asynchronously.", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(type = SchemaType.STRING, example = "101,102,103"), example = "101,102,103")),
@APIResponse(responseCode = "204", description = "Data is valid but no run was created", content = @Content(mediaType = MediaType.TEXT_PLAIN)),
@APIResponse(responseCode = "400", description = "Some fields are missing or invalid", content = @Content(mediaType = MediaType.TEXT_PLAIN))
})
Expand All @@ -247,7 +247,7 @@ Response addRunFromData(@QueryParam("start") String start,
@APIResponses(value = {
@APIResponse(responseCode = "202", description = "The request has been accepted for processing. Returns a list of created run IDs if available, "
+ "or an empty list if processing is still ongoing. Label values and change detection processing " +
"is performed asynchronously.", content = @Content(mediaType = MediaType.TEXT_PLAIN, schema = @Schema(type = SchemaType.STRING, example = "101,102,103"), example = "101,102,103")),
"is performed asynchronously.", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(type = SchemaType.STRING, example = "101,102,103"), example = "101,102,103")),
@APIResponse(responseCode = "204", description = "Data is valid but no run was created", content = @Content(mediaType = MediaType.TEXT_PLAIN)),
@APIResponse(responseCode = "400", description = "Some fields are missing or invalid", content = @Content(mediaType = MediaType.TEXT_PLAIN))
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ Response addRunFromData(String start, String stop, String test,
// if no run ids, means all run upload have been queued up (datastore scenario)
return Response.status(Response.Status.ACCEPTED)
.entity(runs.stream().map(val -> Integer.toString(val.runId)).collect(Collectors.joining(",")))
.type(MediaType.APPLICATION_JSON_TYPE)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import io.hyperfoil.tools.horreum.server.RoleManager;
import io.quarkus.arc.impl.ParameterizedTypeImpl;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
import io.smallrye.jwt.build.Jwt;
Expand Down Expand Up @@ -295,6 +296,7 @@ protected int uploadRun(long start, long stop, Object runJson, String test, Stri
+ access)
.then()
.statusCode(202)
.contentType(ContentType.JSON)
.extract().asString();

List<Integer> runIds = parseCommaSeparatedIds(runIdsAsString);
Expand Down

0 comments on commit d3e4949

Please sign in to comment.