This step definition is used to send an HTTP request (GET, POST, PUT, DELETE, etc.) to a given API endpoint. It’s the action step that actually makes the call using the data, headers, and base URL you’ve set in previous steps.
When (?:I )?send a ([A-Z]+) request to "([^"]+)"$
Tells the test to make an HTTP request using the chosen method (GET, POST, PUT, DELETE…) to the specified path.
Example #1: When I send a GET request to "/users"
Example #2: When I send a POST request to "/posts"
Example #3: When I send a PUT request to "/users/1"
Example #4: When I send a DELETE request to "/posts/1"