hyperjumptech / monika

Monika is a command line application to monitor every part of your web app using a simple YAML configuration file. Get alert not only when your site is down but also when it's slow.
https://monika.hyperjump.tech
MIT License
605 stars 67 forks source link

Fix: Monika sends null request body as string null #1293

Closed haricnugraha closed 6 months ago

haricnugraha commented 6 months ago

Monika Pull Request (PR)

What feature/issue does this PR add

Fix Monika sends null request body as "null".

How did you implement / how did you fix it

  1. Add a test.
  2. Change the request body type.
  3. Remove the non string body conversion using JSON.stringify that caused null becomes "null".

How to test

Run Monika with the following configuration:

probes:
  - id: '1'
    interval: 1
    requests:
      - url: https://idp.sinarmas.com/api/health
        body: null

Demo

output.webm

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 63.89%. Comparing base (6a29470) to head (15f4127). Report is 14 commits behind head on main.

Files Patch % Lines
src/components/probe/prober/http/request.ts 71.42% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1293 +/- ## ========================================== + Coverage 62.51% 63.89% +1.37% ========================================== Files 112 108 -4 Lines 3391 3376 -15 Branches 591 572 -19 ========================================== + Hits 2120 2157 +37 + Misses 1079 1036 -43 + Partials 192 183 -9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.