Git Product home page Git Product logo

Comments (7)

matteodisabatino avatar matteodisabatino commented on August 22, 2024

Same problem here,
I suggest to add a parameter that let the request to send JSON body.
These are the current rows 571-574:

if ((urlMethod === "POST" || urlMethod === "PUT") && urlBody) {
  this.log("Adding Body " + urlBody);
  theRequest.body = urlBody;
}

Adding something like the following should do the trick:

var urlToCall = this.onURL;
var urlMethod = this.onMethod;
var urlBody = this.onBody;
var sendAsJSON = typeof this.onSendAsJSON === 'boolean' ? this.onSendAsJSON : false

// OTHER CODE

if ((urlMethod === "POST" || urlMethod === "PUT") && urlBody) {
  this.log("Adding Body " + urlBody);
  theRequest.body = urlBody;
  theRequest.json = sendAsJSON
}

@xdenneboom Maybe is better to change the title to "Feature request: allow send body as JSON". Or something like that ;-).

from homebridge-http-webhooks.

matteodisabatino avatar matteodisabatino commented on August 22, 2024

@benzman81 sorry to bother, are there news on that?

from homebridge-http-webhooks.

benzman81 avatar benzman81 commented on August 22, 2024

@matteodisabatino feel free to provide a tested pull request.

from homebridge-http-webhooks.

BetoRn avatar BetoRn commented on August 22, 2024

@xdenneboom, @matteodisabatino the example provided for the body is a JSON but it's wrong, needs to be like this:

"on_body": "{"on":true}"

sorry about that.

from homebridge-http-webhooks.

BetoRn avatar BetoRn commented on August 22, 2024

ohh wait! I can't post it correctly, here you have a snapshot of my config

image

from homebridge-http-webhooks.

EddyK69 avatar EddyK69 commented on August 22, 2024

Added PR #66 to add the functionality to add JSON to the form-header...

from homebridge-http-webhooks.

benzman81 avatar benzman81 commented on August 22, 2024

fixed by #66

from homebridge-http-webhooks.

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.