File tree Expand file tree Collapse file tree 5 files changed +18
-18
lines changed
main/java/org/springframework/mock/web
test/java/org/springframework
spring-web/src/test/java/org/springframework/mock/web/test Expand file tree Collapse file tree 5 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -328,25 +328,25 @@ private String getCookieHeader(Cookie cookie) {
328328 StringBuilder buf = new StringBuilder ();
329329 buf .append (cookie .getName ()).append ('=' ).append (cookie .getValue () == null ? "" : cookie .getValue ());
330330 if (StringUtils .hasText (cookie .getPath ())) {
331- buf .append (";Path=" ).append (cookie .getPath ());
331+ buf .append ("; Path=" ).append (cookie .getPath ());
332332 }
333333 if (StringUtils .hasText (cookie .getDomain ())) {
334- buf .append (";Domain=" ).append (cookie .getDomain ());
334+ buf .append ("; Domain=" ).append (cookie .getDomain ());
335335 }
336336 int maxAge = cookie .getMaxAge ();
337337 if (maxAge >= 0 ) {
338- buf .append (";Max-Age=" ).append (maxAge );
339- buf .append (";Expires=" );
338+ buf .append ("; Max-Age=" ).append (maxAge );
339+ buf .append ("; Expires=" );
340340 HttpHeaders headers = new HttpHeaders ();
341341 headers .setExpires (maxAge > 0 ? System .currentTimeMillis () + 1000L * maxAge : 0 );
342342 buf .append (headers .getFirst (HttpHeaders .EXPIRES ));
343343 }
344344
345345 if (cookie .getSecure ()) {
346- buf .append (";Secure" );
346+ buf .append ("; Secure" );
347347 }
348348 if (cookie .isHttpOnly ()) {
349- buf .append (";HttpOnly" );
349+ buf .append ("; HttpOnly" );
350350 }
351351 return buf .toString ();
352352 }
Original file line number Diff line number Diff line change @@ -168,9 +168,9 @@ public void cookies() {
168168
169169 response .addCookie (cookie );
170170
171- assertEquals ("foo=bar;Path=/path;Domain=example.com;" +
172- "Max-Age=0;Expires=Thu, 01 Jan 1970 00:00:00 GMT;" +
173- "Secure;HttpOnly" , response .getHeader (HttpHeaders .SET_COOKIE ));
171+ assertEquals ("foo=bar; Path=/path; Domain=example.com; " +
172+ "Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; " +
173+ "Secure; HttpOnly" , response .getHeader (HttpHeaders .SET_COOKIE ));
174174 }
175175
176176 @ Test
Original file line number Diff line number Diff line change @@ -116,8 +116,8 @@ public void buildResponseHeaders() throws Exception {
116116 assertThat (header .getValue (), equalTo ("value" ));
117117 header = responseHeaders .get (2 );
118118 assertThat (header .getName (), equalTo ("Set-Cookie" ));
119- assertThat (header .getValue (), startsWith ("cookieA=valueA;Path=/path;Domain=domain;Max-Age=1800;Expires=" ));
120- assertThat (header .getValue (), endsWith (";Secure;HttpOnly" ));
119+ assertThat (header .getValue (), startsWith ("cookieA=valueA; Path=/path; Domain=domain; Max-Age=1800; Expires=" ));
120+ assertThat (header .getValue (), endsWith ("; Secure; HttpOnly" ));
121121 }
122122
123123 // SPR-14169
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ public void printResponse() throws Exception {
120120 assertEquals (2 , cookieValues .size ());
121121 assertEquals ("cookie=cookieValue" , cookieValues .get (0 ));
122122 assertTrue ("Actual: " + cookieValues .get (1 ), cookieValues .get (1 ).startsWith (
123- "enigma=42;Path=/crumbs;Domain=.example.com;Max-Age=1234;Expires=" ));
123+ "enigma=42; Path=/crumbs; Domain=.example.com; Max-Age=1234; Expires=" ));
124124
125125 HttpHeaders headers = new HttpHeaders ();
126126 headers .set ("header" , "headerValue" );
Original file line number Diff line number Diff line change @@ -328,25 +328,25 @@ private String getCookieHeader(Cookie cookie) {
328328 StringBuilder buf = new StringBuilder ();
329329 buf .append (cookie .getName ()).append ('=' ).append (cookie .getValue () == null ? "" : cookie .getValue ());
330330 if (StringUtils .hasText (cookie .getPath ())) {
331- buf .append (";Path=" ).append (cookie .getPath ());
331+ buf .append ("; Path=" ).append (cookie .getPath ());
332332 }
333333 if (StringUtils .hasText (cookie .getDomain ())) {
334- buf .append (";Domain=" ).append (cookie .getDomain ());
334+ buf .append ("; Domain=" ).append (cookie .getDomain ());
335335 }
336336 int maxAge = cookie .getMaxAge ();
337337 if (maxAge >= 0 ) {
338- buf .append (";Max-Age=" ).append (maxAge );
339- buf .append (";Expires=" );
338+ buf .append ("; Max-Age=" ).append (maxAge );
339+ buf .append ("; Expires=" );
340340 HttpHeaders headers = new HttpHeaders ();
341341 headers .setExpires (maxAge > 0 ? System .currentTimeMillis () + 1000L * maxAge : 0 );
342342 buf .append (headers .getFirst (HttpHeaders .EXPIRES ));
343343 }
344344
345345 if (cookie .getSecure ()) {
346- buf .append (";Secure" );
346+ buf .append ("; Secure" );
347347 }
348348 if (cookie .isHttpOnly ()) {
349- buf .append (";HttpOnly" );
349+ buf .append ("; HttpOnly" );
350350 }
351351 return buf .toString ();
352352 }
You can’t perform that action at this time.
0 commit comments