Mostafa Sobh
Mostafa Sobh

Reputation: 43

send get request and get html as response

i want to send get request using axios and get the url html source code as response iam usin reactjs and using axios package to send the get request, but it is not working as expected. bottom of line i want to send get request and get response as in the picture below.

here is the code iam trying to make it work:

axios.get('https://www.google.com/').then((res)=>{
     console.log(res.data)
   })

click to see the image

Upvotes: 0

Views: 866

Answers (1)

ROHIT K F
ROHIT K F

Reputation: 101

First of all, you have to know that axios GET requests returns back some data, and not source codes.

Since it can't render HTML, postman shows the source code instead.

So you can only make GET requests to a URL which returns some data

Upvotes: 1

Related Questions