[racket] Question about post-pure-port in the library net/url

From: h = 1-1 (ozooxo at gmail.com)
Date: Sat Oct 19 14:20:16 EDT 2013

Hi,

I am trying to use procedure post-pure-port in the library net/url to
set up some Oauth2 client. Based on

(post-pure-port URL post [header]) → input-port?

  URL : url?
  post : bytes?
  header : (listof string?) = null

the 2nd argument post should be a byte string. However, I can't find
any further information about how to use this argument.

For example, if I do something like

(define target-url (string->url "https://somewebsite.com"))
(define target-post (string->bytes/utf-8 (format
"client_id=~a&client_secret=~a&redirect_uri=~a
                                                 API-key secret
"http://127.0.0.1")))
(define in (post-pure-port target-url target-post))
(port->string in)

my server returns me something like "required_parameter_is_missing:
client_id", so I guess maybe my target-post argument is in the wrong
form.

Can anybody tell me what EXACTLY the form of "post" argument need to
be, or any working example to use the procedure post-pure-port (I
tried to find relevant scripts in github, but failed)? Thanks a lot.

Regards,
Cong-Xin Qiu


Posted on the users mailing list.