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

[#8557] Send caller app name #8570

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[#8557] test web server response caller app name to verify
  • Loading branch information
yjqg6666 committed Dec 30, 2021
commit 5c63bad3b2fb1e4b0478df9c981679d8366e8446
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class WebServer extends NanoHTTPD {
public static final String VERSION = "org.nanohttpd:nanohttpd:2.3.1";
public static final String LOCAL_HOST = "localhost";

public static final String CALLER_RESPONSE_HEADER_NAME = "caller-app";

public WebServer(String hostname, int port) {
super(hostname, port);
}
Expand All @@ -43,7 +45,11 @@ public static WebServer cleanup(WebServer webServer) {
@Override
public Response serve(IHTTPSession session) {
Map<String, List<String>> parameters = session.getParameters();
final String caller = session.getHeaders().get("x-caller-app");
Response response = newFixedLengthResponse(parameters.toString());
if (caller != null) {
response.addHeader(CALLER_RESPONSE_HEADER_NAME, caller);
}
return response;
}

Expand Down