RESPONSE_NULL_HANDLING
Control how NULL results are returned in responses.
Keywords
response_null_handling, response_null
Syntax
response_null <mode>
response_null_handling <mode>Values
| Value | Description |
|---|---|
empty_string | NULL returned as empty string "" |
null_literal | NULL returned as JSON null |
204_no_content | NULL returns HTTP 204 No Content |
Examples
Return Empty String for NULL
sql
comment on function get_value(_id int) is
'HTTP GET
response_null empty_string';If result is NULL → Response body: ""
Return 204 for NULL
sql
comment on function find_record(_id int) is
'HTTP GET
response_null 204_no_content';If result is NULL → HTTP 204 with no body
Return JSON null
sql
comment on function get_optional(_key text) is
'HTTP GET
response_null null_literal';If result is NULL → Response body: null
Related
- NpgsqlRest Options configuration - Configure default null handling
- Comment Annotations Guide - How annotations work
- Configuration Guide - How configuration works
Related Annotations
- QUERY_STRING_NULL_HANDLING - NULL in query strings