Configuring Graphql Resolver with Azure Function and HttpTrigger by POST

Configuring Graphql Resolver with Azure Function and HttpTrigger by POST


0

I have an API Management Service in Azure, there I’m trying to configure my first mutation but I’m having troubles configuring the Resolver Policiy, let me share more details:

Here is my mutation:

Configuring Graphql Resolver with Azure Function and HttpTrigger by POST

my ResolverPolicy looks like this:

<http-data-source>
    <http-request>
      <set-method>POST</set-method>
      <set-url>[URL]</set-url>
      <set-header name="Content-Type" exists-action="override">
        <value>application/json</value>
      </set-header>
      <set-body>@{
        var args = context.Request.Body.As<JObject>(true)["arguments"];  
        JObject jsonObject = new JObject();
        jsonObject.Add("messageId", args["messageId"]);
        jsonObject.Add("senderUserId", args["senderUserId"]);
        jsonObject.Add("receiverUserId", args["receiverUserId"]);
        jsonObject.Add("messageContent", args["messageContent"]);
        return jsonObject.ToString();
      }</set-body>
    </http-request>
  </http-data-source>

when I try to run this, Azure says

Configuring Graphql Resolver with Azure Function and HttpTrigger by POST

I configured my mutation by GET and it worked fine, but we need to run it by POST

What’s is wrong with my Resolver Policy?

Thanks in advance


Load 7 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *