Reputation: 11
So what I mean to say is that I want to send get/post requests to invalid url (e.g. https://this-is-a-fake-url.com) I know it will give error because url does not exist but I want to know a way so that it would give a 200 response code. So that if someone use wireshark or something to capture api requests, he would see many requests all having return code 200, no matter if the link is valid or not. Is it even possible? If so, please help :)
Upvotes: 0
Views: 420
Reputation: 409
You can start a local server, and add it into hosts
file. More specific, if you are on a linux machine:
this-is-a-fake-url.com
to your localhostsudo cat '127.0.0.1 this-is-a-fake-url.com' >> /etc/hosts
# In windows, write to C:\Windows\System32\drivers\etc
sudo python3 -m http.server
# Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
curl http://this-is-a-fake-url.com:8000 -v
# * Trying 127.0.0.1:8000...
# * TCP_NODELAY set
# * Connected to this-is-a-fake-url.com (127.0.0.1) port 8000 (#0)
# > GET / HTTP/1.1
# > Host: this-is-a-fake-url.com:8000
# > User-Agent: curl/7.68.0
# > Accept: */*
# >
# * Mark bundle as not supporting multiuse
# * HTTP 1.0, assume close after body
# < HTTP/1.0 200 OK
# ...
Upvotes: 0