Stack Exchange
unable to use proxy with axios
I tried to send post request via proxy in axios but it's giving errors but it was working in python requests(with same url,headers,proxy,payload); I have configured proxy according to axios but still it's not working
Expected: JSON response
Actual Response: ヾ(*ФωФ)βyё βyё☆彡
Tried: Changing syntax
const axios = require('axios');
const url2 = "https://replicate.com/api/predictions";
        const headers2 = {
            "Origin": "https://replicate.com"
        };

        const payload2 = {
            "input": {
                "width": 1024,
                "height": 1024,
                "prompt": 'cow',
                "refine": "expert_ensemble_refiner",
                "scheduler": "K_EULER",
                "lora_scale": 0.6,
                "num_outputs": 1,
                "guidance_scale": 7.5,
                "apply_watermark": false,
                "high_noise_frac": 1,
                "negative_prompt": '',
                "prompt_strength": 0.8,
                "num_inference_steps": 50
            },
            "is_training": false,
            "create_model": "0",
            "stream": false,
            "version": "39ed52f2a78e934b3ba6e2a89f5b1c712de7dfea535525255b1aa35c5565e08b"
        };
const proxyConfig = {
    host: '50.171.152.30',
    port: 80,
    protocol: 'http'
};

axios.post(url2, payload2,{ headers: headers2, proxy: proxyConfig, timeout: 45000 })
.then((r) => {
  
 console.log(r.data);
  
}).catch((err) => {
  
 console.error(err);
  
});


It might be helpful if you provide the error you're getting

i am getting this output which i should not get ヾ(*ФωФ)βyё βyё☆彡 it should return a json response
