Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make sure we format the response as json when status is 202, fixes #2245 #2258

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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