# How to sniff http request

**URL:** <https://discourse.nodered.org/t/how-to-sniff-http-request/89110>\
**Category:** General\
**Created:** [30 June 2024 13:36 UTC](https://discourse.nodered.org/t/how-to-sniff-http-request/89110 "2024-06-30T13:36:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giamma](https://avatars.discourse-cdn.com/v4/letter/g/e47774/32.png) [@Giamma](https://discourse.nodered.org/u/Giamma)\
**Post date:** [30 June 2024 13:36 UTC](https://discourse.nodered.org/t/how-to-sniff-http-request/89110/1 "2024-06-30T13:36:23Z")

</div>

I use the node node-red-contrib-sun-position to have data of sun and moon position but I would like not use this node but an http request ....

How can I sniff the http request sent by the node node-red-contrib-sun-position?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 June 2024 13:56 UTC](https://discourse.nodered.org/t/how-to-sniff-http-request/89110/2 "2024-06-30T13:56:33Z")

</div>

I don't think it does send a request. I think it just calculates it using [suncalc3 - npm](https://www.npmjs.com/package/suncalc3)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [30 June 2024 14:08 UTC](https://discourse.nodered.org/t/how-to-sniff-http-request/89110/3 "2024-06-30T14:08:36Z")

</div>

Here is an example of how to use [suncalc3](https://www.npmjs.com/package/suncalc3) in a function node. You add the module in the function nodes setup tab.

```auto
[{"id":"c15cbedc83d28648","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{}","payloadType":"json","x":235.9541015625,"y":4859.02734375,"wires":[["3c3dfdd83b03e76b"]]},{"id":"3c3dfdd83b03e76b","type":"function","z":"d1395164b4eec73e","name":"function 157","func":"const lat = 50.8015;\nconst lon = 0.3170;\nconst dateValue = new Date();\nmsg.payload.moon = suncalc.getMoonPosition(dateValue, lat, lon)\nmsg.payload.sun = suncalc.getPosition(dateValue, lat, lon)\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"suncalc","module":"suncalc3"}],"x":425.9541015625,"y":4859.02734375,"wires":[["7229b6af4a0552b4"]]},{"id":"7229b6af4a0552b4","type":"debug","z":"d1395164b4eec73e","name":"debug 429","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":4780,"wires":[]}]

```

Read here to set up functionExternalModules in settings.js [Writing Functions : Node-RED](https://nodered.org/docs/user-guide/writing-functions#using-the-functionexternalmodules-option)

p.s could you also change the title to `how to get sun and moon positions` or similar, as the title does not help others search for what this topic is about.

---

<div class="post-metadata">

**Author:** ![Giamma](https://avatars.discourse-cdn.com/v4/letter/g/e47774/32.png) [@Giamma](https://discourse.nodered.org/u/Giamma)\
**Post date:** [30 June 2024 14:13 UTC](https://discourse.nodered.org/t/how-to-sniff-http-request/89110/4 "2024-06-30T14:13:54Z")

</div>

@Colin  
@E1cid

Thank you ....

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 September 2024 14:14 UTC](https://discourse.nodered.org/t/how-to-sniff-http-request/89110/5 "2024-09-28T14:14:50Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
