Azure / Azure/azure-functions-java-library

Event Hubs bindings does not honor http status code

Open
#73 0 comments 0 reactions 0 assignees View on GitHub
area:java-functions
Dominant language
Java
Stars
45
Forks
49
PR merge metrics
No merged PRs in 30d

Description

@FunctionName("HttpTrigger-EmailOutBound")
@EventHubOutput(name = "message", eventHubName = "eventHubTest", connection = "AzureEventHubConnection")
public HttpResponseMessage run(
@HttpTrigger(name = "httpRequestMessage", methods = {HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS)
HttpRequestMessage> 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](https://user-images.githubusercontent.com/5192274/50112455-43fd1280-020d-11e9-8ef9-b15f6e3414b1.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.