Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

80
Views
URL is empty when defining a Response object

I am trying to create a Response request like that:

Response { type: "basic", url: "https://mywebsite.com/download?lang=en", status: 200, ok: true, statusText: "SuperSmashingGreat!"}

I read here how to set a new Response object, and I tried:

var myBlob = new Blob();

var init = {
  "status": 200,
  "statusText": "SuperSmashingGreat!",
  "url": "https://mywebsite.com/download?lang=en",
  "ok": "true"
};

var myResponse = new Response(myBlob, init);

console.log(myResponse)

After I run it, I received this Response object without the url (it is empty url: ""):

{
  type: "default",
  url: "",
  redirected: false,
  status: 200,
  ok: true,
  statusText: "SuperSmashingGreat!",
  headers: Headers,
  body: ReadableStream,
  bodyUsed: false
}

Why it is not being set?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Thanks for @Blair Nangle for the comment, based on this website.
I used:

Object.defineProperty(resp, "url", { value: "foobar" });  

Full working code:

var myBlob = new Blob();

var init = {
  "status": 200,
  "statusText": "SuperSmashingGreat!",
  "url": "https://mywebsite.com/download?lang=en",
  "ok": "true"
};

var resp = new Response(myBlob, init);

Object.defineProperty(resp, "resp", { value: "https://mywebsite.com/download?lang=en" });
console.log(myResponse)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!