HTTP request

Friday, 18 October 2019 · 2 messages
GC
Giuseppe G. A. Celano18 Oct 2019 16:38 #

Hi,

I have a curl request of the kind

curl --data "something" http://something <http://something/>

which I would like to perform using the HTTP module, but I cannot specify the data argument in the query. Any help?

The following does not work:

http:send-request(<http:request method="post"></http:request>, 'http://something' , "something" )

Best, Giuseppe

CG
Christian Grün18 Oct 2019 16:54 #

Ciao Giuseppe,

The media-type may be missing in your request:

  http:send-request(
    <http:request method='post'>
      <http:body media-type='application/octet-stream'/>
    </http:request>,
    'http://something',
    'something'
  )

See [1,2] for more information.

Hope this helps, Christian

[1] http://docs.basex.org/wiki/HTTP_Module#POST_Request [2] http://expath.org/spec/http-client#d2e178

Quoted text · Giuseppe G. A. Celano · 13 lines
> curl --data "something" http://something > > which I would like to perform using the HTTP module, but I cannot specify the data argument in the query. Any help? > > The following does not work: > > http:send-request(<http:request method="post"></http:request>, > 'http://something' , > "something" > ) > > Best, > Giuseppe

⚡Generated with XQuery