Skip to content

Commit

Permalink
Remove cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
hexiaofeng committed Jan 27, 2025
1 parent 1b14b9a commit e82b522
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.util.MultiValueMapAdapter;

import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -91,9 +90,10 @@ public void setHeader(String key, String value) {

@Override
protected RequestData buildRequestData() {
Map<String, List<String>> cookies = getCookies();
return new RequestData(request.getMethod(), request.getURI(), request.getHeaders(),
cookies == null ? null : new MultiValueMapAdapter<>(cookies), null);
// cookie is used only in RequestBasedStickySessionServiceInstanceListSupplier
// it's disabled by live interceptor
// so we can use null value to improve performance.
return new RequestData(request.getMethod(), request.getURI(), request.getHeaders(), null, null);
}

public byte[] getBody() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ public void setHeader(String key, String value) {

@Override
protected RequestData buildRequestData() {
Map<String, List<String>> cookies = getCookies();
// cookie is used only in RequestBasedStickySessionServiceInstanceListSupplier
// it's disabled by live interceptor
// so we can use null value to improve performance.
return new RequestData(
org.springframework.http.HttpMethod.resolve(request.httpMethod().name()), getURI(),
new HttpHeaders(new MultiValueMapAdapter<>(getHeaders())),
cookies == null ? null : new MultiValueMapAdapter<>(cookies), null);
new HttpHeaders(new MultiValueMapAdapter<>(getHeaders())), null, null);
}

public Request.Options getOptions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.springframework.http.HttpCookie;
import org.springframework.http.HttpHeaders;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.util.MultiValueMapAdapter;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.util.UriComponentsBuilder;

Expand Down Expand Up @@ -131,9 +130,10 @@ public boolean isInstanceSensitive() {

@Override
protected RequestData buildRequestData() {
Map<String, List<String>> cookies = getCookies();
return new RequestData(request.getMethod(), request.getURI(), request.getHeaders(),
cookies == null ? null : new MultiValueMapAdapter<>(cookies), null);
// cookie is used only in RequestBasedStickySessionServiceInstanceListSupplier
// it's disabled by live interceptor
// so we can use null value to improve performance.
return new RequestData(request.getMethod(), request.getURI(), request.getHeaders(), null, null);
}

@Override
Expand Down

0 comments on commit e82b522

Please sign in to comment.