Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

body handleAs String and not manage JSON Object #37

@jmorille

Description

@jmorille

The core-ajax accept only string and not Json Object in body attribute.

The core-ajax should detect in body in order to apply the JSON.stringify(bodyObject) when is needed

Exemple

<polymer-element name="post-test">
  <template>
    <core-ajax id="ajax"
      url="/api/post"
      method="POST"
      handleAs="json"
      body="{{bodyObject}}">
    </core-ajax>
  </template>
  <script>
  Polymer({
   bodyObject : {
                fron : 0,
                size: 10,
                body: {
                    query: {
                        match_all :{}
                    }
                }
            } ,
       postHandler: function() { 
            this.$.ajax.go();
        }

  });
  </script>
</polymer-element>

It was post as

Request Payload
[object Object]

instead of

Request Payload
{"from":0,"size":10,"_source":["categorie","solution"],"body":{"query":{"match_all":{}},"aggs":{"statut":{"terms":{"order":{"_count":"desc"},"field":"statut"}}}}}
Response Headersview source

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions