Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

82
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda