Skip to content

Commit

Permalink
Support PATCH method in HTTP controllers #9131
Browse files Browse the repository at this point in the history
  • Loading branch information
rymsha committed Jan 3, 2025
1 parent 227175a commit 34eeac1
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void testOptions()
final WebResponse response = this.handler.handle( this.request, WebResponse.create().build(), null );
assertNotNull( response );
assertEquals( HttpStatus.OK, response.getStatus() );
assertEquals( "GET,POST,HEAD,OPTIONS,PUT,DELETE,TRACE", response.getHeaders().get( "Allow" ) );
assertEquals( "GET,POST,HEAD,OPTIONS,PUT,DELETE,TRACE,PATCH", response.getHeaders().get( "Allow" ) );
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void testOptions()
final WebResponse res = this.handler.handle( this.request, PortalResponse.create().build(), null );
assertNotNull( res );
assertEquals( HttpStatus.OK, res.getStatus() );
assertEquals( "GET,POST,HEAD,OPTIONS,PUT,DELETE,TRACE", res.getHeaders().get( "Allow" ) );
assertEquals( "GET,POST,HEAD,OPTIONS,PUT,DELETE,TRACE,PATCH", res.getHeaders().get( "Allow" ) );
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void testOptions()
final WebResponse res = this.handler.handle( this.request, PortalResponse.create().build(), null );
assertNotNull( res );
assertEquals( HttpStatus.OK, res.getStatus() );
assertEquals( "GET,POST,HEAD,OPTIONS,PUT,DELETE,TRACE", res.getHeaders().get( "Allow" ) );
assertEquals( "GET,POST,HEAD,OPTIONS,PUT,DELETE,TRACE,PATCH", res.getHeaders().get( "Allow" ) );
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testOptions()
final WebResponse res = this.handler.handle( this.request, PortalResponse.create().build(), null );
assertNotNull( res );
assertEquals( HttpStatus.OK, res.getStatus() );
assertEquals( "GET,POST,HEAD,OPTIONS,PUT,DELETE,TRACE", res.getHeaders().get( "Allow" ) );
assertEquals( "GET,POST,HEAD,OPTIONS,PUT,DELETE,TRACE,PATCH", res.getHeaders().get( "Allow" ) );
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void testOptions()
final WebResponse res = this.handler.handle( this.request, PortalResponse.create().build(), null );
assertNotNull( res );
assertEquals( HttpStatus.OK, res.getStatus() );
assertEquals( "GET,POST,HEAD,OPTIONS,PUT,DELETE,TRACE", res.getHeaders().get( "Allow" ) );
assertEquals( "GET,POST,HEAD,OPTIONS,PUT,DELETE,TRACE,PATCH", res.getHeaders().get( "Allow" ) );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void testOptions()
final WebResponse res = this.handler.handle( this.request, PortalResponse.create().build(), null );
assertNotNull( res );
assertEquals( HttpStatus.OK, res.getStatus() );
assertEquals( "GET,POST,HEAD,OPTIONS,PUT,DELETE,TRACE", res.getHeaders().get( "Allow" ) );
assertEquals( "GET,POST,HEAD,OPTIONS,PUT,DELETE,TRACE,PATCH", res.getHeaders().get( "Allow" ) );
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ public enum HttpMethod
{
GET, POST, HEAD, OPTIONS, PUT, DELETE, TRACE, CONNECT, PATCH, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK;

private static final EnumSet<HttpMethod> STANDARD_METHODS = EnumSet.of( GET, POST, HEAD, OPTIONS, PUT, DELETE, TRACE, PATCH );

public static EnumSet<HttpMethod> all()
{
return EnumSet.allOf( HttpMethod.class );
}

public static EnumSet<HttpMethod> standard()
{
return EnumSet.of( GET, POST, HEAD, OPTIONS, PUT, DELETE, TRACE );
return STANDARD_METHODS.clone();
}
}

0 comments on commit 34eeac1

Please sign in to comment.