Code Monkey home page Code Monkey logo

Comments (6)

alihaghani avatar alihaghani commented on June 3, 2024 1

That's odd, the exact same code deployed locally with lib http gives the ParameterError whereas when deployed to dev with lib up dev, it seems to work fine.

Nevermind, I was missing the trailing / in the Postman local URL... Thanks.

from cli.

notoriaga avatar notoriaga commented on June 3, 2024

Hey @alihaghani, would you mind providing a small code sample?

from cli.

alihaghani avatar alihaghani commented on June 3, 2024

This is the function/endpoint.

from cli.

notoriaga avatar notoriaga commented on June 3, 2024

Oh sorry, I meant the calling code. What you have looks good for the endpoint. Is it possible you're not setting the Content-Type of your request to 'application/json'?

from cli.

alihaghani avatar alihaghani commented on June 3, 2024

Got it. I'm doing a POST from Postman with the body as follows:

{
    "chores": [
        {
            "title": "Task 1"
        },
        {
            "title": "Task 2"
        }
    ],
    "members": [
        {
            "name": "Member 1",
            "phone": "16040000000"
        }
    ]
}

I also have a header key Content-Type with the value application/json as well as a token in the header. Is my request body malformed?

from cli.

notoriaga avatar notoriaga commented on June 3, 2024

I think I got an example working in postman. Go to File -> Import -> Paste Raw Text and enter the following -

{
	"info": {
		"_postman_id": "c1cb1c4c-b668-467a-9661-e24cb4c62ca3",
		"name": "example",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "post example",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"name": "Content-Type",
						"value": "application/json",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n  \"chores\": [\n    {\n      \"title\": \"Task 1\"\n    },\n    {\n      \"title\": \"Task 2\"\n    }\n  ],\n  \"members\": [\n    {\n      \"name\": \"Member 1\",\n      \"phone\": \"16040000000\"\n    }\n  ]\n}"
				},
				"url": {
					"raw": "http://alihaghani.lib.id/abode@dev/initializeHome/",
					"protocol": "http",
					"host": [
						"alihaghani",
						"lib",
						"id"
					],
					"path": [
						"abode@dev",
						"initializeHome",
						""
					]
				}
			},
			"response": []
		}
	]
}

Let me know if that works!

from cli.

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.