JCMais / node-libcurl

libcurl bindings for Node.js
https://npmjs.org/package/node-libcurl
MIT License
658 stars 115 forks source link

Converting to node-libcurl request #359

Closed SwapnilSoni1999 closed 6 months ago

SwapnilSoni1999 commented 2 years ago

Hi I have the following request. Which works from curl but not from node-libcurl

./curl -L 'https://drivetest.ca/booking/v1/driver/token' \ 
  -H 'authority: drivetest.ca' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: en_US' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json;charset=UTF-8' \
  -H $'cookie: BIGipServerwp_drivetest.ca=\u0021vOzia8hSmknmiesfUOrqTBwwXM+Xp5GVAJ1XORRHoH6uwg9PAOv4OJjzP/nhMrFM8Oo3DVeqiHiztA==; wp-wpml_current_language=en; BIGipServerwp_drivetest_booking.ca=\u0021HGGqqPC1JIkjsZEfUOrqTBwwXM+XpxDK1OfvfJio9UTtilxxE2dt9fyuKyKWWVyAWAFehA1rOA60wQ==; _gid=GA1.2.1540518290.1660176480; cf_clearance=Wwqdj6vestDmZ30jl7Jn.8QMSGjBSgQQucK.I1NNAK4-1660220632-0-150; __cf_bm=5oi7mumy5pro0RKEDtwBktJ7Y__TV5GRG4G8qIVB_TA-1660248684-0-AYghda8SAly0NOK2aKkVuD4DKJ+yVN6i89lesXC9UxJw5VkVklvpkGvNt++YNyOWKzi2nmEFd1K7gT+yzQ9Y52reYZbzWTqTU6BS3L1tlJ+jy33z0HteCiZsVXogUo4490qJh6PXo/s+fcno14KFWEPXKvI7MmZxWPLViqrh1Xpe; _ga_RB8BJ51NGF=GS1.1.1660248683.85.0.1660249055.0; _ga=GA1.2.124245551.1651444907; _gat_gtag_UA_203465073_1=1; _ga_42QPJNZ5JD=GS1.1.1660249056.57.1.1660249061.0' \
  -H 'origin: https://drivetest.ca' \
  -H 'pragma: no-cache' \
  -H 'referer: https://drivetest.ca/dtbookingngapp/registration/confirmRegistration' \
  -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="102", "Google Chrome";v="102"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Linux"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-origin' \
  -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36' \
  --data-raw '{"licenceNumber":"xxxx-91118","licenceExpiry":"2027/xx/xx"}' \
  --compressed
JCMais commented 2 years ago

what is not working exactly? What is the Node.js code you are using?