Browse Source

Merge pull request #1 from ulysseg/master

reply 401 on wrong API key
pull/1/head
Sebastien Blanc 4 years ago
committed by GitHub
parent
commit
2ae4d57c01
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/main/java/org/sebi/incident/IncidentResource.java

9
src/main/java/org/sebi/incident/IncidentResource.java

@ -1,10 +1,9 @@
package org.sebi.incident;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import org.eclipse.microprofile.config.inject.ConfigProperty;
@ -19,11 +18,11 @@ public class IncidentResource {
@GET
public List<Incident> getIncidents(@QueryParam("api_key") String apiKey){
public Response getIncidents(@QueryParam("api_key") String apiKey){
if(this.apiKey.equals(apiKey)){
return Incident.listAll();
return Response.ok(Incident.listAll()).build();
}
return null;
return Response.status(Response.Status.UNAUTHORIZED).build();
}
@GET

Loading…
Cancel
Save