Git Product home page Git Product logo

Comments (2)

kiranz avatar kiranz commented on August 27, 2024 2

@benjamin-rood That's a good feature to have. Adding it to backlog.

Meanwhile, you can still read request payload from JSON files as done below
Note: CustomRequire and CustomPath are regular js require and path modules exported in c.js which runs as part of configuration of a suite.

meta:
   name: POST raw body requests (json , text, binary )
configuration:
  custom_configuration:
    run_type: module
    module:
      module_path: ./c.js
      function_name: main  
specs:
  - name: JSON data (file) as body
    before_test:
      run_type: inline
      inline:
        function: !!js/function >
          function() {
            const payload = CustomRequire(CustomPath.resolve(process.cwd(), "p.json"));
            this.test.payload = {body: {type: 'json', content: payload}};            
          }     
    request:
      path: /echoBinaryBodyResponseStats
      method: post
      headers:
        - name: content-type
          value: application/json
    response:
      status_code: 200
      json_data:
        - path: $.request_content_size
          value: 12371

c.js

"use strict";


global.CustomRequire = require;
global.CustomPath = require("path");



function main() {
  this.scheme = "http";
  this.host = "127.0.0.1";
  this.port = 3027;
}

module.exports = {
  main
};

from just-api.

benjamin-rood avatar benjamin-rood commented on August 27, 2024

Thanks, @kiranz I will make use of this approach in the mean time!

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.