Giter Site home page Giter Site logo

Comments (3)

trestletech avatar trestletech commented on May 22, 2024

Hi Frank,

How much control do you have over the client sending the data? It seems to me that alternative formats might be a better fit for this structure of data. I'm thinking for instance that you could pass in JSON a la endpoint?data="[{a:1, b:2}, {a:3, b:4}] and parse the data frame out in that way.

I'm pushing back just because any time I've had to work with repeated query string parameters in any programming language/framework, it's always felt cludgy. So that idea makes me a little reserved about diving in to support the feature (though of course you can do whatever you want in your fork!).

I don't see any obvious problems with the method you proposed, nor am I sure why you'd be getting those errors, but I'm not totally surprised that it didn't work. I can imagine that some list of arguments to pass in is being indexed by parameter name, so as it encounters multiple parameters with the same name some get dropped or something.

from plumber.

FrankPortman avatar FrankPortman commented on May 22, 2024

Hi,

Thanks for the quick reply.

Actually I ended up being able to fix it. The issue was curl being unhappy with newline characters in the data argument. If you do the curl command with a file input instead:

curl --data "`cat test_file`"

or

curl --data-binary @test_file 

then it seems to work as expected. A side benefit is that passing in just one row still works!

I've considered doing it the way you are suggesting as well and then unwrapping it within the function itself and I may end up going that route in the future. Is there anywhere you can point me to to learn more about the JSON input format you're suggesting? I'm only used to interfacing with plumber using --data "a=1&b=2...".

from plumber.

trestletech avatar trestletech commented on May 22, 2024

I don't have a formal reference on the topic, but you could look at serializing with jsonlite::toJSON() and within your plumber function deserializing using jsonlite::fromJSON(). In that case, the variable you're trying to parse is just a string.

That format seems a little more typical, at least from what I've seen, but I don't know that there are any compelling reasons to prefer it over your approach.

from plumber.

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.