EventSource icon indicating copy to clipboard operation
EventSource copied to clipboard

How to pass 'body' params to EventSourcePolyfill?

Open sabetAI opened this issue 4 years ago • 3 comments

If I have a curl request like the following:

curl -G https://api.openai.com/v1/engines/davinci/completions/browser_stream \
  --data-urlencode prompt='Once upon a time' \
  --data-urlencode max_tokens=3 \
  -H 'Authorization: Bearer YOUR_API_KEY'

How do I pass --data-urlencode prompt='Once upon a time' to my to EventSourcePolyfill request?

sabetAI avatar Aug 06 '21 19:08 sabetAI

there is no option to send POST request or add a body to a request, could you add a query parameter instead?

Yaffle avatar Aug 06 '21 20:08 Yaffle

Sure, could you show me an example?

sabetAI avatar Aug 07 '21 00:08 sabetAI

new EventSource("https://example.com/?prompt=Once%20upon%20a%20time&max_tokens=3")

Yaffle avatar Aug 07 '21 01:08 Yaffle