hkrlys
hkrlys

Reputation: 441

How to get the url from the request on the cloud function?

I just can't find this simple thing.

exports.contentServer = functions.https.onRequest((request, response) => 

I am getting ipn from PayPal (POST), and i have to confirm that its actually comes from PayPal.

I am trying to get the url from the request but i can't. I only get the path:

request.url
request.path

both only show me the path which is /paid. I have to confirm it is actually a PayPal URL with this path.

How to check the url ?

   if(request.path === "paid"  &&  url base is paypal)

Upvotes: 1

Views: 2267

Answers (1)

marian.vladoi
marian.vladoi

Reputation: 8066

You can try:

exports.helloWorld = functions.https.onRequest((req, res) => {

var fullUrl = req.protocol + '://' + req.get('Origin') + req.originalUrl;
res.status(200).send(fullUrl);

});

Please check this related question: link.

Upvotes: 1

Related Questions