Comments (3)
Patching the spec.js
file with a synchronous read fixed the problem.
I'm not sure this is is what was intended.
-bodyData.body = fs.createReadStream(file);
+bodyData.body = fs.readFileSync(file);
Edit: removed encoding
from just-api.
@YYOANN Just ran a test with node v13.8.0
and just-api v1.2.5
and it runs as expected.
Here's a sample suite I tried with.
meta:
name: POST raw body requests (json , text, binary )
configuration:
scheme: http
host: 127.0.0.1
port: 3027
specs:
- name: post binary data (file) as body
request:
path: /echoBinaryBodyResponseStats
method: post
headers:
- name: content-type
value: image/png
payload:
body:
type: binary
content: static/assets/logo.png
response:
status_code: 200
json_data:
- path: $.request_content_size
value: 12371
If you are still having issues, please update the issue with an attachment containing your suite so I can take look.
Note: Make sure that the file exists at static/assets/logo.png
in the directory where you invoke tests from
from just-api.
I tried to reproduce the issue today and now everything is working as expected, locally and in docker, I can't figure out what was wrong. I'll update the issue if I find something.
Thanks for your help.
from just-api.
Related Issues (20)
- Question: Multiple REST endpoints in suite HOT 2
- Can't call async functions in end event for custom reports HOT 4
- Cannot add proxy, hence cannot intercept requests HOT 1
- Could you set the userContext for loop functions HOT 3
- Is it possible to use just-api as a library ? HOT 1
- [Feature request] Make just-api a module
- runSpec doesn't execute before_test HOT 2
- Use return value of one request for next one HOT 1
- How to set proxy up for GraphQL API which seats in a corporation network
- Allow GraphQL request body to be a file path HOT 2
- Intersuite dependencies at level 3 or more of nesting
- A spec MUST have a request and response minimally? HOT 1
- Difference in execution plan depending on how spec is called? HOT 2
- Failing tests in master: otherverbs and urlencodedformpost
- Post request common_headers ignored when asserting Content-Type header
- Docs missing instructions on running CI test suite HOT 1
- Suite custom_configuration from module ignores common_headers
- Enhancement: allow JSON pointer to schema within file
- Deprecate use of gulp to allow run on modern node version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from just-api.