query, header enabled 적용
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.eactive.httpmockserver.api.controller;
|
||||
|
||||
import com.eactive.httpmockserver.api.dto.MockConditionDTO;
|
||||
import com.eactive.httpmockserver.api.dto.MockRequest;
|
||||
import com.eactive.httpmockserver.api.entity.MockCondition;
|
||||
import com.eactive.httpmockserver.api.entity.MockResponse;
|
||||
|
||||
@@ -2,9 +2,19 @@ package com.eactive.httpmockserver.client.dto;
|
||||
|
||||
public class ApiHeaderDTO {
|
||||
|
||||
private boolean enabled;
|
||||
|
||||
private String key;
|
||||
private String value;
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.eactive.httpmockserver.client.service;
|
||||
|
||||
import com.eactive.httpmockserver.client.dto.ApiHeaderDTO;
|
||||
import com.eactive.httpmockserver.client.dto.ApiRequestDTO;
|
||||
import com.eactive.httpmockserver.client.dto.ApiResponse;
|
||||
import com.eactive.httpmockserver.client.entity.Server;
|
||||
@@ -85,8 +86,10 @@ public class NettyApiClient {
|
||||
|
||||
if (apiRequest.getHeaders().size() > 0) {
|
||||
HttpHeaders customHeaders = new DefaultHttpHeaders();
|
||||
apiRequest.getHeaders().forEach((header) -> {
|
||||
customHeaders.set(header.getKey(), header.getValue());
|
||||
apiRequest.getHeaders().stream().filter(ApiHeaderDTO::isEnabled).forEach((header) -> {
|
||||
if(StringUtils.isNotEmpty(header.getKey()) && StringUtils.isNotEmpty(header.getValue())){
|
||||
customHeaders.set(header.getKey(), header.getValue());
|
||||
}
|
||||
});
|
||||
request.headers().add(customHeaders);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user