METHOD-001PASS
GET /users - Allowed method
Sample Request
curl -X GET -H "X-API-Key: valid-key" http://localhost:8080/usersExpected Response
HTTP/1.1 200 OKGET requests to /users are allowed as defined in the OpenAPI spec.
12 tests verify that only allowed HTTP methods are accepted per endpoint as defined in the OpenAPI specification.
Each endpoint defines which HTTP methods are allowed:
# openapi.yaml
paths:
/users:
get: # GET allowed
summary: "List users"
post: # POST allowed
summary: "Create user"
# DELETE not defined = blocked!
/users/{id}:
get: # GET allowed
summary: "Get user"
put: # PUT allowed
summary: "Update user"
delete: # DELETE allowed
summary: "Delete user"curl -X GET -H "X-API-Key: valid-key" http://localhost:8080/usersHTTP/1.1 200 OKGET requests to /users are allowed as defined in the OpenAPI spec.
curl -X POST -H "X-API-Key: valid-key" \
-H "Content-Type: application/json" \
-d '{"name": "John", "email": "john@example.com"}' \
http://localhost:8080/usersPOST is allowed on /users for creating new resources.
curl -X DELETE -H "X-API-Key: valid-key" http://localhost:8080/usersHTTP/1.1 405 Method Not Allowed
Allow: GET, POST
Content-Type: application/json
{"error": "Method not allowed", "allowed": ["GET", "POST"]}DELETE requests are blocked if not explicitly defined for this endpoint. This prevents mass deletion attacks.
curl -X DELETE -H "X-API-Key: valid-key" http://localhost:8080/users/550e8400-e29b-41d4-a716-446655440000DELETE is allowed on /users/{id} for deleting specific resources, as defined in the OpenAPI spec.
curl -X PATCH -H "X-API-Key: valid-key" -d '{"name": "New"}' http://localhost:8080/usersPATCH is not defined in the OpenAPI spec for /users, so it is rejected.
curl -X TRACE http://localhost:8080/usersTRACE and other potentially dangerous methods are blocked by default to prevent XST (Cross-Site Tracing) attacks.