{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-functions-java-library/issues/22","repository_url":"https://api.github.com/repos/Azure/azure-functions-java-library","labels_url":"https://api.github.com/repos/Azure/azure-functions-java-library/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-functions-java-library/issues/22/comments","events_url":"https://api.github.com/repos/Azure/azure-functions-java-library/issues/22/events","html_url":"https://github.com/Azure/azure-functions-java-library/issues/22","id":335766392,"node_id":"MDU6SXNzdWUzMzU3NjYzOTI=","number":22,"title":"HttpResponseMessage became not useable from version 1.1.0-beta4 to 1.1.0-beta5","user":{"login":"nicenemo","id":2677108,"node_id":"MDQ6VXNlcjI2NzcxMDg=","avatar_url":"https://avatars0.githubusercontent.com/u/2677108?v=4","gravatar_id":"","url":"https://api.github.com/users/nicenemo","html_url":"https://github.com/nicenemo","followers_url":"https://api.github.com/users/nicenemo/followers","following_url":"https://api.github.com/users/nicenemo/following{/other_user}","gists_url":"https://api.github.com/users/nicenemo/gists{/gist_id}","starred_url":"https://api.github.com/users/nicenemo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicenemo/subscriptions","organizations_url":"https://api.github.com/users/nicenemo/orgs","repos_url":"https://api.github.com/users/nicenemo/repos","events_url":"https://api.github.com/users/nicenemo/events{/privacy}","received_events_url":"https://api.github.com/users/nicenemo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-26T11:02:02Z","updated_at":"2018-07-26T03:54:04Z","closed_at":null,"author_association":"NONE","body":"## API for http trigger changed  breakingfrom 1.0.0-beta-4 to 1.0.0-beta-5\r\n\r\n1. `HttpResponseMessage` became none generic\r\n2.  A `HttpResponseMessage` can now be generated using a builder from the request\r\n3.  If you try to return that `HttpResponseMessage`, the runtime complains that it wants an  output binding for the trigger.\r\n4. Documentation still talks about a `HttpResponseMessage<T>`\r\n\r\n## Error message\r\n\r\n```\r\n``CMD\r\n[6/26/2018 10:27:09 AM] Host started (2071ms)\r\n[6/26/2018 10:27:09 AM] Job host started\r\n[6/26/2018 10:27:09 AM] The following 1 functions are in error:\r\n[6/26/2018 10:27:09 AM] test: At least one binding must be declared.\r\n```\r\n\r\n## Expected\r\n\r\nUpdated  documentation on how to return http responses in a controlled way instead of returning a string or throw an Exception.\r\n\r\n## Sample code\r\n\r\nThe code below compiles with `1.100-beta-5`, but the runtime moans about wanting an `output binding`:\r\n\r\n**UPDATE:** if I change to just return a String and throw exceptions in case of errors it still wants a an output binding.\r\n\r\n```Java\r\n \r\n  @FunctionName(\"test\")\r\n  public HttpResponseMessage test(//\r\n      @HttpTrigger(//\r\n          name = \"req\", //\r\n          methods = {HttpMethod.GET},\r\n          authLevel = AuthorizationLevel.FUNCTION) //\r\n      final HttpRequestMessage<String> req, //\r\n      final ExecutionContext context) {\r\n\r\n    requireNonNull(context, \"Context should not be null in \" + CREATE_TEST_MY_SESSION_METHOD_NAME);\r\n    // creating a session\r\n    final String sessionID = createRandomSessionID();\r\n    final Logger logger = prepareLogger(context, environment, sessionID);\r\n    logEntering(logger, this.getClass(), CREATE_TEST_MY_SESSION_METHOD_NAME);\r\n    requireNonNull(req, \"Req should not be null in \" + CREATE_TEST_MY_SESSION_METHOD_NAME);\r\n\r\n    final CompletableFuture<HttpResponseMessage> completableFuture = new CompletableFuture<>();\r\n    HttpResponseMessage response = null;\r\n    try {\r\n      getFunctionsExecutor().submit(() -> completableFuture.complete(testInternal(req, sessionID, logger)));\r\n      response = completableFuture.get(4, TimeUnit.SECONDS);\r\n    } catch (InterruptedException | ExecutionException | TimeoutException e) {\r\n      final String msg = String.format(\"%s:[%s]: %s\", getVersionPrefixWithSessionID(sessionID),\r\n          CREATE_TEST_MY_SESSION_METHOD_NAME, e.getMessage());\r\n      response = req //\r\n          .createResponseBuilder(HttpStatus.SERVICE_UNAVAILABLE) //\r\n          .header(RETRY_AFTER, TWO_MINUTES) //\r\n          .header(HttpHeaders.CONTENT_TYPE, TEXT_PLAIN) //\r\n          .body(msg) //\r\n          .build();\r\n    } catch (final Throwable e) {\r\n      logThrowable(logger, e.getMessage(), e);\r\n      final String msg = UNEXPECTED_EXCEPTION_MESSAGE + sessionID;\r\n      response = req //\r\n          .createResponseBuilder(HttpStatus.SERVICE_UNAVAILABLE) //\r\n          .header(RETRY_AFTER, TWO_MINUTES) //\r\n          .header(HttpHeaders.CONTENT_TYPE, TEXT_PLAIN) //\r\n          .body(msg) //\r\n          .build();\r\n    } finally {\r\n      logExiting(logger, this.getClass(), CREATE_TEST_MY_SESSION_METHOD_NAME);\r\n    }\r\n    return response;\r\n  }\r\n```"},"comment":{"url":"https://api.github.com/repos/Azure/azure-functions-java-library/issues/comments/407968425","html_url":"https://github.com/Azure/azure-functions-java-library/issues/22#issuecomment-407968425","issue_url":"https://api.github.com/repos/Azure/azure-functions-java-library/issues/22","id":407968425,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzk2ODQyNQ==","user":{"login":"pragnagopa","id":1874279,"node_id":"MDQ6VXNlcjE4NzQyNzk=","avatar_url":"https://avatars0.githubusercontent.com/u/1874279?v=4","gravatar_id":"","url":"https://api.github.com/users/pragnagopa","html_url":"https://github.com/pragnagopa","followers_url":"https://api.github.com/users/pragnagopa/followers","following_url":"https://api.github.com/users/pragnagopa/following{/other_user}","gists_url":"https://api.github.com/users/pragnagopa/gists{/gist_id}","starred_url":"https://api.github.com/users/pragnagopa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pragnagopa/subscriptions","organizations_url":"https://api.github.com/users/pragnagopa/orgs","repos_url":"https://api.github.com/users/pragnagopa/repos","events_url":"https://api.github.com/users/pragnagopa/events{/privacy}","received_events_url":"https://api.github.com/users/pragnagopa/received_events","type":"User","site_admin":false},"created_at":"2018-07-26T03:54:04Z","updated_at":"2018-07-26T03:54:04Z","author_association":"CONTRIBUTOR","body":"Functions Runtime is not deployed yet. Please subscribe to \r\nhttps://github.com/Azure/app-service-announcements/issues/122"}}
{"actor":{"display_login":"pragnagopa"}}