You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Moleculer v.012ctx.meta comes back to the caller. It means requests send context meta information back to API Gateway, like response status code, response headers, response content type...etc.
Meta keys what API Gateway will process:
ctx.meta.$responseType - set Content-Type in response
ctx.meta.$responseHeaders - set custom response headers
ctx.meta.$responseStatus - set HTTP status code in response
ctx.meta.$location - redirect location when the $responseStatus is 3xx
Example
{exportData(ctx){// Set meta for API GWctx.meta.$responseStatus=200;ctx.meta.$responseType="text/csv; charset=utf-8";ctx.meta.$responseHeaders={"Content-Disposition": 'attachment; filename=\"data.csv\"'}// Return datareturnthis.getAllRows();}}
The text was updated successfully, but these errors were encountered:
Since Moleculer v.012
ctx.meta
comes back to the caller. It means requests send context meta information back to API Gateway, like response status code, response headers, response content type...etc.Meta keys what API Gateway will process:
ctx.meta.$responseType
- setContent-Type
in responsectx.meta.$responseHeaders
- set custom response headersctx.meta.$responseStatus
- set HTTP status code in responsectx.meta.$location
- redirect location when the$responseStatus
is 3xxExample
The text was updated successfully, but these errors were encountered: