mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
(api-service) Improved testability, always set content type to application/json
This commit is contained in:
parent
397a85eaa4
commit
6319b8ef51
@ -79,6 +79,8 @@ public class ApiService extends Service {
|
||||
|
||||
var license = licenseService.getLicense(request.params("key"));
|
||||
|
||||
response.type("application/json");
|
||||
|
||||
var cachedResponse = responseCache.getResults(license, args[0], request.queryString());
|
||||
if (cachedResponse.isPresent()) {
|
||||
return cachedResponse.get();
|
||||
@ -90,7 +92,6 @@ public class ApiService extends Service {
|
||||
// We set content type late because in the case of error, we don't want to tell the client
|
||||
// that the error message is JSON when it is plain text.
|
||||
|
||||
response.type("application/json");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class QueryService extends Service {
|
||||
query.specs,
|
||||
rsp.results,
|
||||
query.searchTermsHuman,
|
||||
List.of(),
|
||||
List.of(), // no problems
|
||||
query.domain
|
||||
);
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ services:
|
||||
ports:
|
||||
- "127.0.0.1:8080:80"
|
||||
- "127.0.0.1:8081:81"
|
||||
- "127.0.0.1:8082:82"
|
||||
volumes:
|
||||
- "./run/nginx-site.conf:/etc/nginx/conf.d/default.conf"
|
||||
networks:
|
||||
@ -175,4 +176,4 @@ volumes:
|
||||
driver_opts:
|
||||
type: none
|
||||
o: bind
|
||||
device: run/samples
|
||||
device: run/samples
|
||||
|
@ -66,4 +66,23 @@ server {
|
||||
access_log off;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 82;
|
||||
listen [::]:82;
|
||||
server_name control;
|
||||
|
||||
proxy_set_header X-Context $remote_addr-$connection;
|
||||
proxy_set_header X-Extern-Url $scheme://$host$request_uri;
|
||||
proxy_set_header X-Extern-Domain $scheme://$host;
|
||||
proxy_set_header X-User-Agent $http_user_agent;
|
||||
|
||||
proxy_set_header X-Public "1";
|
||||
|
||||
location / {
|
||||
proxy_pass http://api-service:5004/public/;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user