sa_set_http_header system procedure

Function

Permits a Web service to set an HTTP header in the result.

Syntax

sa_set_http_header ( field-name, value )

Permissions

None.

See also

“sa_set_http_option system procedure”

Description

call dbo.sa_set_http_header( 'Content-Type', 'text/html' )

Setting the special header field @HttpStatus sets the status code returned with the request. For example, the following command sets the status code to 404 Not Found.

dbo.sa_set_http_header( '@HttpStatus', '404' )

The body of the error message is inserted automatically. Only valid HTTP error codes can be used. Setting the status to an invalid code causes an SQL error.