Skip to content

Add xml request body parsing + xpath #48

@hhalex

Description

@hhalex

Request body should be accessible when crafting the response.
Multiple possibilities can be studied:

Request body

<rootnode>
  <value>
    hello
  </value>
</rootnode>

api.yml

rules:
  - matches: POST /test
     response: !Inline [200, "<ok>{{body.xml.rootnode.value}}</ok>", "application/xml"] 

Or with a handlebars helper
api.yml

rules:
  - matches: POST /test
     response: !Inline [200, "<ok>{{#xpath body //value}}<anothervalue>{{@this}}</anothervalue>{{/xpath}}</ok>", "application/xml"] 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions