Code Monkey home page Code Monkey logo

Comments (5)

x80486 avatar x80486 commented on June 11, 2024 1

And this one is also working like a charm 🍹

response:
  callback: # https://apisimulator.io/docs/latest/standalone-api-simulator/callback.html
    http1:
      body:
        file: ${simlet.path}/character-subscription.request.json
      from: template
    ...
{
  "first_name": "${_json.evalJsonPath(_request.bodyText, '.first_name')}",
  "last_name": "${_json.evalJsonPath(_request.bodyText, '.last_name')}",
  "age": ${_json.evalJsonPath(_request.bodyText, '.age')},
  "subscriber_id": "${character_id}"
}

image

from apisimulator.

apisim avatar apisim commented on June 11, 2024

Yes - as the documentation for v1.9 states "...A file as source for the callback request body is not currently supported".

It is still possible to have the body come from a file by using Parameter from File. For example:

BodyFromFileParm:
  is: parameter
  from: file
  file: ${simlet.path}/body.json

response:
  ...   
  callback:
    http2:
      from: template
      ...
      body: ${ BodyFromFileParm }

from apisimulator.

x80486 avatar x80486 commented on June 11, 2024

I didn't overlook this one 😉

Is this something you are going to consider, or is it too complicated to implement? I know the "Parameter from File" solution is useful as a counterpart, but it feels strange that almost everywhere else (I know of) the "DSL" supports file solution, but this one in particular do not.

from apisimulator.

apisim avatar apisim commented on June 11, 2024

Gotcha.

It is a bit inconsistent with the support of file elsewhere, agreed. I frankly don't remember why it wasn't implemented "day one"...but it shouldn't be complicated to implement.

from apisimulator.

apisim avatar apisim commented on June 11, 2024

This enhancement was included in the just released v1.10.

Give it a try when you get a chance, @x80486
Thanks!

from apisimulator.

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.