mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05: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"));
|
var license = licenseService.getLicense(request.params("key"));
|
||||||
|
|
||||||
|
response.type("application/json");
|
||||||
|
|
||||||
var cachedResponse = responseCache.getResults(license, args[0], request.queryString());
|
var cachedResponse = responseCache.getResults(license, args[0], request.queryString());
|
||||||
if (cachedResponse.isPresent()) {
|
if (cachedResponse.isPresent()) {
|
||||||
return cachedResponse.get();
|
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
|
// 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.
|
// that the error message is JSON when it is plain text.
|
||||||
|
|
||||||
response.type("application/json");
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class QueryService extends Service {
|
|||||||
query.specs,
|
query.specs,
|
||||||
rsp.results,
|
rsp.results,
|
||||||
query.searchTermsHuman,
|
query.searchTermsHuman,
|
||||||
List.of(),
|
List.of(), // no problems
|
||||||
query.domain
|
query.domain
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:8080:80"
|
- "127.0.0.1:8080:80"
|
||||||
- "127.0.0.1:8081:81"
|
- "127.0.0.1:8081:81"
|
||||||
|
- "127.0.0.1:8082:82"
|
||||||
volumes:
|
volumes:
|
||||||
- "./run/nginx-site.conf:/etc/nginx/conf.d/default.conf"
|
- "./run/nginx-site.conf:/etc/nginx/conf.d/default.conf"
|
||||||
networks:
|
networks:
|
||||||
@ -175,4 +176,4 @@ volumes:
|
|||||||
driver_opts:
|
driver_opts:
|
||||||
type: none
|
type: none
|
||||||
o: bind
|
o: bind
|
||||||
device: run/samples
|
device: run/samples
|
||||||
|
@ -66,4 +66,23 @@ server {
|
|||||||
access_log off;
|
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