On 05/21/2014 09:15 AM,
vladac...@gmail.com wrote:
> Hi,
>
> I am trying to implement some CORS-enabled Web services. To do this, I
> need to be able to reply to an OPTIONS HTTP request with a reply having
> the following headers:
>
> Access-Control-Allow-Origin: *
> Access-Control-Allow-Methods: GET, POST, PUT
> Access-Control-Allow-Headers: <<list of allowed headers>>
>
> I looked at the http_reply/3 predicate for this purpose, but I can't find any instructions/examples for how to set its arguments so that it sends a reply
> with an empty body and containing (possibly among others) the headers above.
Simply do this before sending the body:
format('Access-Control-Allow-Methods: GET, POST, PUT~n'),
etc.
You may wish to use library(http/http_cors). You may also need to
extend it though.
Cheers --- Jan
>
> Could anyone give me some suggestions as to how to call this predicate, or how to otherwise send the described HTTP reply?
>
> Best regards,
> Vlad
> |
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
swi-prolog+...@googlegroups.com
> <mailto:
swi-prolog+...@googlegroups.com>.
> Visit this group at
http://groups.google.com/group/swi-prolog.
> For more options, visit
https://groups.google.com/d/optout.