hurl icon indicating copy to clipboard operation
hurl copied to clipboard

Allow types in fenced content of request bodies

Open tpluscode opened this issue 3 years ago • 2 comments

Problem to solve

To get some syntax support in request bodies I noticed that I can have my IDE (intellij) to recognise known file types as I would in markdown

POST /endpoint
```sparql
Syntax support here \o/
```

Unfortunately, at least in version 1.8.2, the word sparql is included as part of the body

Proposal

Would it be as simple as ignoring trailing characters after the opening triple backtick?

tpluscode avatar Dec 19 '22 10:12 tpluscode

Hi @tpluscode we've changed the syntax for the incoming 2.0.0, to support GraphQL body type (see #1000):

POST https://foo.com/graphql
```graphql
query {
  user
}
```

For the moment, I think we make a parsing error if the type is anything apart json, xml, graphql. We may be considering support any string here, or having a broader white list. What do you think @fabricereix?

jcamiel avatar Dec 19 '22 11:12 jcamiel

Maybe we should indeed accept any string to be used as doc. If it is really used by Hurl to create a specific body (such as graphql) we could log it in verbose mode.

fabricereix avatar Dec 19 '22 16:12 fabricereix