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

438
Visualizações
convert cURL command to http put request

i need to convert the following cURL command:

curl --request PUT \
--url https://storage.bunnycdn.com/storage/path/index.jpeg \
--header 'AccessKey: <AccessKey>' \
--header 'Content-Type: application/octet-stream' \
--data-binary @/home/path/to/index.jpeg

which sends a put request with an image to be uploaded to a CDN

to an https put request, specially with the --data-binary

i tried :

   try {
                  var request = new http.MultipartRequest("PUT", uri);
                  request.headers.addAll({
                    'content-type': 'multipart/form-data',
                    'AccessKey': '<AccessKey>',
                  });

                  request.files.add(
                    await http.MultipartFile.fromPath(
                      'file',
                      _image.path,
                      filename: fileName,
                    ),

                  );

                  var response = request.send().then((value) => setState(() {
                        isLoading = false;
                      }));
                } catch (e) {
                  print(e);
                }

but unfortunately the file arrives at the CDN storage with wrong formatting.

how can i upload the image with http put request as --data-binary

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use postman to convert curl to some languages, to javascript postman return this:

var request = require('request');
var options = {
  'method': 'PUT',
  'url': 'https://storage.bunnycdn.com/storage/path/index.jpeg',
  'headers': {
    'AccessKey': '<AccessKey>',
    'Content-Type': 'application/octet-stream'
  },
  body: '@/home/path/to/index.jpeg'

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

This is just a example, so if you need something more elaborated do it.

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