Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

86
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda