Commit ace2915e authored by Grzegorz Pietrusza's avatar Grzegorz Pietrusza

use httpMethod

parent cb3c2b61
package com.telephoners.krakyournet.ctf.beans.tasks;
import com.telephoners.krakyournet.ctf.beans.User;
import org.eclipse.jetty.http.HttpMethod;
import java.util.Map;
public class TaskRequestContext
{
private String httpMethod; //todo: use class
private HttpMethod httpMethod; //todo: use class
private User user;
private String path;
private String body;
private Map<String, String> headers;
public TaskRequestContext withHttpMethod(String httpMethod)
public TaskRequestContext withHttpMethod(HttpMethod httpMethod)
{
this.httpMethod = httpMethod;
return this;
......@@ -40,7 +41,7 @@ public class TaskRequestContext
return this;
}
public String getHttpMethod()
public HttpMethod getHttpMethod()
{
return httpMethod;
}
......
......@@ -8,6 +8,7 @@ import com.telephoners.krakyournet.ctf.core.ApplicationConfiguration;
import com.telephoners.krakyournet.ctf.helpers.StreamUtils;
import com.telephoners.krakyournet.ctf.repositories.TasksRepository;
import io.dropwizard.auth.Auth;
import org.eclipse.jetty.http.HttpMethod;
import org.glassfish.jersey.server.ContainerRequest;
import javax.inject.Inject;
......@@ -71,7 +72,7 @@ public class TaskResource
}
Map<String, String> headers = extractProxiedHeaders(containerRequestContext.getHeaders());//todo: inline
TaskRequestContext taskRequestContext = new TaskRequestContext()
.withHttpMethod("POST")
.withHttpMethod(HttpMethod.GET)
.withUser(user)
.withPath(fullPath)
.withHeaders(headers);
......@@ -106,7 +107,7 @@ public class TaskResource
Map<String, String> headers = extractProxiedHeaders(containerRequestContext.getHeaders());//todo: inline
TaskRequestContext taskRequestContext = new TaskRequestContext()
.withHttpMethod("POST")
.withHttpMethod(HttpMethod.POST)
.withUser(user)
.withPath(fullPath)
.withBody(body)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment