Git Product home page Git Product logo

Comments (3)

YYOANN avatar YYOANN commented on August 27, 2024

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.

kiranz avatar kiranz commented on August 27, 2024

@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.

YYOANN avatar YYOANN commented on August 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.