Azure / azure-functions-java-library

Contains annotations for writing Azure Functions in Java
MIT License
43 stars 43 forks source link

Event Hubs bindings does not honor http status code #73

Open tarinidash opened 5 years ago

tarinidash commented 5 years ago

@FunctionName("HttpTrigger-EmailOutBound") @EventHubOutput(name = "message", eventHubName = "eventHubTest", connection = "AzureEventHubConnection") public HttpResponseMessage run( @HttpTrigger(name = "httpRequestMessage", methods = {HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional> httpRequestMessage, final ExecutionContext context) { return httpRequestMessage .createResponseBuilder(HttpStatus.UNAUTHORIZED) .body("unauthorized") .build(); }

Expected OutPut : HttpStatus Code : 401 Actual : HttpStatusCode: 200

Output:

{ "method": "", "query": {}, "statusCode": "401", "headers": {}, "enableContentNegotiation": false, "body": "unauthorized" }

Even the response body has the statusCode 401 , the actual response has 200.

image