[FIX] missing ARCHIVE & RESTORE in OPTION and correct the typescript request

This commit is contained in:
Edouard DUPIN 2024-10-23 16:32:00 +02:00
parent 5c1b7cd193
commit cd3a6a1d8b
2 changed files with 9 additions and 3 deletions

View File

@ -21,6 +21,7 @@ public class CORSFilter implements ContainerResponseFilter {
response.getHeaders().add("Access-Control-Allow-Headers", response.getHeaders().add("Access-Control-Allow-Headers",
"Origin, content-type, Content-type, Accept, Authorization, mime-type, filename, Range"); "Origin, content-type, Content-type, Accept, Authorization, mime-type, filename, Range");
response.getHeaders().add("Access-Control-Allow-Credentials", "true"); response.getHeaders().add("Access-Control-Allow-Credentials", "true");
response.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD"); response.getHeaders().add("Access-Control-Allow-Methods",
"GET, POST, PUT, PATCH, DELETE, ARCHIVE, RESTORE, OPTIONS, HEAD");
} }
} }

View File

@ -252,9 +252,14 @@ export function RESTRequest({
if (restModel.accept !== undefined) { if (restModel.accept !== undefined) {
headers["Accept"] = restModel.accept; headers["Accept"] = restModel.accept;
} }
if (restModel.requestType !== HTTPRequestModel.GET) { if (restModel.requestType !== HTTPRequestModel.GET &&
restModel.requestType !== HTTPRequestModel.ARCHIVE &&
restModel.requestType !== HTTPRequestModel.RESTORE
) {
// if Get we have not a content type, the body is empty // if Get we have not a content type, the body is empty
if (restModel.contentType !== HTTPMimeType.MULTIPART) { if (restModel.contentType !== HTTPMimeType.MULTIPART &&
restModel.contentType !== undefined
) {
// special case of multi-part ==> no content type otherwise the browser does not set the ";bundary=--****" // special case of multi-part ==> no content type otherwise the browser does not set the ";bundary=--****"
headers["Content-Type"] = restModel.contentType; headers["Content-Type"] = restModel.contentType;
} }