Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request body is undefined in listen.js #1298

Closed
stc1988 opened this issue Jan 27, 2024 · 2 comments
Closed

Request body is undefined in listen.js #1298

stc1988 opened this issue Jan 27, 2024 · 2 comments

Comments

@stc1988
Copy link
Contributor

stc1988 commented Jan 27, 2024

Build environment: macOS,
Moddable SDK version: 4.3.10-16-gb5dc9fe31
Target device: mac

Steps to Reproduce

  1. Build and install the example/io/listener/listen app using this build command: mcconfig -d -m -p mac
  2. POST reqeust to listen server.
curl -X POST -H "Content-Type: application/json" -d "{"key":"value"}" localhost/json

The log of body is undefined.

POST
http://localhost/json
host: localhost
user-agent: curl/8.4.0
accept: */*
content-type: application/json
content-length: 11
undefined

Other information

I think options in Request is mismatch between body and requestPromise

@phoddie
Copy link
Collaborator

phoddie commented Jan 28, 2024

Thanks for the report. I'm able to reproduce the behavior you describe We'll investigate.

@phoddie
Copy link
Collaborator

phoddie commented Jan 28, 2024

Your analysis was correct! Change line 157 to:

const request = new Request(new URL(path, base), { method, path, headers, body:requestPromise });

We will include this in the next update. Thank you.

mkellner pushed a commit that referenced this issue Feb 1, 2024
@stc1988 stc1988 closed this as completed Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants