package mantra.net.http
HttpResponse
CLASS
public class
Fluent response builder supporting HTTP status codes, headers, and automatic JSON response formatting.
🏗️ Constructor Summary
Constructor Signature
def __init__(self, status_code: Int)
⚙️ Method Summary
| Modifier & Return Type | Method Signature | Description |
|---|---|---|
HttpResponse |
json(body: String) |
Sets payload and Content-Type: application/json. |
String |
render() |
Renders raw HTTP wire protocol byte sequence. |
🔍 Detailed Method Specifications
pub def json(body: String) -> HttpResponse
Sets payload and Content-Type: application/json.
pub def render() -> String
Renders raw HTTP wire protocol byte sequence.
💡 Example Usage
httpresponse_example.mantra
return HttpResponse(200).json("{\"status\": \"ok\"}")