Code Monkey home page Code Monkey logo

moltin-request's Issues

GET requests fails

After upgrading to the latest version I'm having trouble doing get-requests. It looks like a body is attached to the request which makes it fail. Here's the error I'm getting:

TypeError: Request with GET/HEAD method cannot have body
at new Request (/user_code/node_modules/@moltin/request/node_modules/node-fetch/lib/index.js:1191:10)
at /user_code/node_modules/@moltin/request/node_modules/node-fetch/lib/index.js:1369:19
at Object.fetch (/user_code/node_modules/@moltin/request/node_modules/node-fetch/lib/index.js:1367:9)
at Object.fetch (/user_code/node_modules/@moltin/request/node_modules/cross-fetch/dist/node-ponyfill.js:10:20)
at createClient. (/user_code/node_modules/@moltin/request/dist/index.js:89:46)
at step (/user_code/node_modules/@moltin/request/dist/index.js:43:23)
at Object.next (/user_code/node_modules/@moltin/request/dist/index.js:24:53)
at fulfilled (/user_code/node_modules/@moltin/request/dist/index.js:15:58)
at process._tickDomainCallback (internal/process/next_tick.js:135:7) }"

request_1.MoltinClient is not a constructor

Using version 2.0.0 with the following code:

import { MoltinClient } from '@moltin/request'

const client = new MoltinClient({
    client_id: process.env.MOLTIN_CLIENT_ID,
    client_secret: process.env.MOLTIN_CLIENT_SECRET
})

Error if host is specified

If I try specifying a host, I get an error.

Example:

const client = new MoltinClient({
  client_id: 'some id',
  host: 'api.moltin.com',
});

client
  .get('products')
  .then(console.log)
  .catch(console.error);

I get this error:

error: TypeError: Only absolute URLs are supported
    at getNodeRequestOptions (/Users/user/dev/some-project/functions/node_modules/node-fetch/lib/index.js:1299:9)
    at /Users/user/dev/some-project/functions/node_modules/node-fetch/lib/index.js:1404:19
    at new Promise (<anonymous>)
    at MoltinClient.fetch (/Users/user/dev/some-project/functions/node_modules/node-fetch/lib/index.js:1401:9)
    at MoltinClient.fetch (/Users/user/dev/some-project/functions/node_modules/cross-fetch/dist/node-ponyfill.js:10:20)
    at MoltinClient.<anonymous> (/Users/user/dev/some-project/functions/node_modules/@moltin/request/dist/index.js:136:51)
    at step (/Users/user/dev/some-project/functions/node_modules/@moltin/request/dist/index.js:43:23)
    at Object.next (/Users/user/dev/some-project/functions/node_modules/@moltin/request/dist/index.js:24:53)
    at /Users/user/dev/some-project/functions/node_modules/@moltin/request/dist/index.js:18:71
    at new Promise (<anonymous>)

I think docs need some update!

I want to create a whishlist to my customers,

I follow this steps and I am stack in the #8 step. How to get: CUSTOMER_FLOW_ID

Even when I add the wishlist it is not shown in the customers custome field there is no field added.
And one other think. Please add array filed in filed type in the flows filed I think this will solve a lot of problems.

And, We are waiting more tutorials from your youtube channel.

Thanks!

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): update dependency @types/fetch-mock to v7.3.5
  • chore(deps): update dependency typescript to v3.9.10
  • fix(deps): update dependency cross-fetch to v3.1.5
  • chore(deps): update dependency semantic-release to v19

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.


  • Check this box to trigger a request for Renovate to run again on this repository

How to POST a file?

I have a Blob object and I want to send it to server.
Here is my code based on your docs:
`
const formData = new FormData();
formData.append("file_name", productName);
formData.append("public", "true");
formData.append("mime_type", "image/png");

canvas.toBlob(blob => {
formData.append("file", blob, productName);
});

const headers = {
"Content-Type": "image/png"
};
const data = {
body: formData
};
moltin
.post("files", data, headers)
.then(data => console.log(data))
.catch(err => console.error(err));
`

I am always getting {status: 500, title: "InternalError", detail: "Cannot read property 'file' of undefined", request_id: "xxx..."}

Any solution please!

Thanks in advance!

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.