nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.37k stars 323 forks source link

Wasm: Allow to set the HTTP response status. #948

Closed ac000 closed 1 year ago

ac000 commented 1 year ago

This commit enables WebAssembly modules to set the HTTP response status to something other than the previously hard coded '200 OK'.

To do this they can make a call to nxt_wasm_set_resp_status() providing the required status code.

If this function isn't called the status code defaults to '200 OK'. The WebAssembly module can also return -1 from the request_handler function as a short cut to signal a '500 Internal Server Error'.

ac000 commented 1 year ago

@hongzhidao

Just a heads up. I plan to merge this early next week...

ac000 commented 1 year ago

This has been merged https://github.com/nginx/unit/commit/76086d6d7a027ddf42d86897200a53d724fb4bb7.