Giter Site home page Giter Site logo

Comments (7)

Gusyatnikova avatar Gusyatnikova commented on June 4, 2024 1

Hi, @leopku, you can try to add by yourself something like this:

  1. To pkg/stdlib/types file to_binary.go with function
func ToBinary(ctx context.Context, args ...core.Value) (core.Value, error) {
	err := core.ValidateArgs(args, 1, 1)

	if err != nil {
		return values.None, err
	}

	val := args[0].String()

	return values.NewBinary([]byte(val)), nil
}
  1. To pkg/stdlib/types/tib.go add raw to RegisterLib func
    "TO_BINARY": ToBinary,

  2. In your script use
    `Let binaryBody = to_binary('"id"=15')
    LET result = IO::NET::HTTP::POST({

    url: "https://httpbin.org/post",

    body: binaryBody,

    headers: {"Content-Type": "application/json"}

})
`

The reason of this error is absence of to_binary in ferret

from ferret.

Gusyatnikova avatar Gusyatnikova commented on June 4, 2024

Hello!

You can use to_binary function:
Let binaryBody = to_binary('"id"=15')

Hope it helps,
Natalia

from ferret.

errshoff avatar errshoff commented on June 4, 2024

Does not work:
compile query: not found: function: 'TO_BINARY'

from ferret.

3timeslazy avatar 3timeslazy commented on June 4, 2024

@errshoff didn't you try to pass req instead of JSON_STRINGIFY(req)?

from ferret.

errshoff avatar errshoff commented on June 4, 2024

@3timeslazy I tried. The result is the same:
invalid type: expected [binary], but got object

from ferret.

leopku avatar leopku commented on June 4, 2024

Same issue. not found: function: 'TO_BINARY'
@errshoff , should you plz sharing how did you fixed it?

from ferret.

leopku avatar leopku commented on June 4, 2024

@Gusyatnikova thanks a lot.

from ferret.

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.