Added
return_conn command. It accepts a response dictionary (very similar to AWS api gateway response) and streams the response back to the client. In short, you can do the following to echo the request back to the client (including a file):
proc process_request {request_dict} {
set content_type [dict get $request_dict headers content-type]
set is_base64_encoded [dict get $request_dict isBase64Encoded]
set body [dict get $request_dict body]
set response [dict create \
statusCode 200 \
headers [dict create Content-Type $content_type] \
multiValueHeaders {} \
isBase64Encoded $is_base64_encoded \
body $body]
return $response
}# and then use return_conn instead of write_conn, e.g.:
::twebserver::return_conn $conn $response