tarampampam / webhook-tester

🔭 Powerful tool for testing WebHooks and more
MIT License
182 stars 29 forks source link

Query params cause 404 #389

Open namuller30 opened 1 year ago

namuller30 commented 1 year ago

When I make a request to a session and pass in query params a 404 is returned. I would expect them to be stored as part of the request and a 200 returned.

curl "https://127.0.0.1:8080/e808f6fc-ac62-46bc-a031-1da6302a5912?foo=bar"
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>Error 404 - Not found</title>

  <style>
    body {
      background-color: #222;
      color: #aaa;
      font-family: 'Hack', monospace;
    }

    #error_text {
      position: absolute;
      top: 50%;
      left: 0;
      right: 0;
      text-align: center;
      margin-top: -35px;
      height: 30px;
      font-size: 2em;
    }
  </style>
</head>
<body>

<div id="error_text">Error 404: Not found</div>

<script>
  'use strict';

  const setCharAt = function (str, index, chr) {
    return (index > str.length - 1)
      ? str
      : str.substr(0, index) + chr + str.substr(index + 1);
  };

  const $errorText = document.getElementById('error_text');
  const text = $errorText.innerText;

  let progress = 0;

  const scrambleInterval = window.setInterval(() => {
    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=+<>,./?[{()}]!@#$%^&*~`\|'.split('');
    let message = text;

    for (let i = 0; i < text.length; i++) {
      if (i >= progress) {
        message = setCharAt(message, i, characters[Math.round(Math.random() * (characters.length - 1))]);
      }
    }

    $errorText.innerText = message;
  }, 800 / 60);

  window.setTimeout(() => {
    let revealInterval = window.setInterval(() => {
      if (progress < text.length) {
        progress++;
      } else {
        clearInterval(revealInterval);
        clearInterval(scrambleInterval);
      }
    }, 70);
  }, 500);
</script>
</body>
</html>
gareth-johnstone commented 6 months ago

Also appear to be having the same issue - is there a chance of a fix @tarampampam ?

tarampampam commented 6 months ago

Unfortunately, my regular workload is quite heavy, and any free time I have is dedicated to another one of my open-source projects (after all, there are only 24 hours in a day!). So, while I'd love to address this issue when I have the time, if someone else is able to submit a pull request with the fix, I'd be more than happy to review and merge it as soon as possible

gareth-johnstone commented 6 months ago

No worries, i know how projects can just take over!

I'll have a crack at a fix and pr!

gareth-johnstone commented 6 months ago

Based on a little digging around, I think this line might the reason query strings are producing a 404!

https://github.com/tarampampam/webhook-tester/blob/92bd37197c5128ec03db8294469137456a6a2542/internal/http/fileserver/handler.go#L25

path.Clean(x) strips query strings - I'm not sure how the code will behave once query strings are allowed - as it looks like its doing some kind of lookup here

Still trying to get this building on Windows 11 to test it :)

Could also be wildly incorrect here, only used Go Lang twice in my life 😂😂

tarampampam commented 1 week ago

Hello! Apologies for the late response, but I have good news - I have fixed this bug, along with a number of other improvements I made while working on version 2 of the app.

It would be great if you could try out the early test build and share your feedback. Do all the features work as expected? Did you encounter any crashes, or notice anything that isn’t functioning as intended?

The Docker image and precompiled binary files are available at this link: https://github.com/tarampampam/webhook-tester/releases/tag/v2.0.0-alpha1