This step definition is used to send an HTTP request with a raw body provided as a multiline string (PyString). It’s useful when you want to include more complex JSON or plain text directly in your test step.
When (?:I )?send a ([A-Z]+) request to "([^"]+)" with body:$
Sends a request (POST, PUT, etc.) to the specified endpoint using the provided body exactly as written.
Example:
When I send a POST request to "/users" with body:
"""
{
"name": "John Doe",
"email": "john@example.com"
}
"""