Skip to content

Commit

Permalink
Merged Pull Request '#54 ClientsidePropertyServiceCore-allow-origin->…
Browse files Browse the repository at this point in the history
…main : Clientside property service core allow origin'

Clientside property service core allow origin
  • Loading branch information
Automation51D authored Apr 16, 2024
2 parents c517520 + f26f7f6 commit a2fb572
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,14 @@ public void serveContent(
default:
break;
}
response.getWriter().write(content);

setHeaders(
response,
hash,
content == null ? 0 : content.length(),
contentType == ContentTypes.JavaScript ? "x-javascript" : "json");

response.getWriter().write(content);
}

}
Expand All @@ -270,6 +271,7 @@ private void setHeaders(
response.setHeader("Cache-Control", stringJoin(cacheControl, ","));
response.setHeader("Vary", stringJoin(headersAffectingJavaScript, ","));
response.setHeader("ETag", Integer.toString(hash));
response.setHeader("Access-Control-Allow-Origin", "*");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ private void ValidateResponse(
else {
verify(response, times(0)).setHeader(eq("ETag"), anyString());
}

verify(response).setHeader(eq("Access-Control-Allow-Origin"), eq("*"));
}

@SuppressWarnings("rawtypes")
Expand Down

0 comments on commit a2fb572

Please sign in to comment.