0
public function customHeaders()
{
    return [
        'Authorization' => request()->header('Authorization'),
        'Content-Type' => 'multipart/form-data',
        'Access-Control-Allow-Credentials' => true,
    ];
}

public function post(Request $request)
{
    $response = Http::withHeaders($this->customHeaders())->post($this->url, $request->all());
    return response()->json($response->json(), $response->status());
}

I have no problem using application/json but I get 404 when using multipart/form-data

toffeegz
  • 88
  • 6

1 Answers1

0
public function customHeaders()
{
    return (
        'multipart' => [        
        'Authorization' => request()->header('Authorization'),
        'Content-Type' => 'multipart/form-data',
        'Access-Control-Allow-Credentials' => true,
        'Content-Disposition' => 'multipart',
        'name' => 'multipart'        
   ],
        'form-data' => [        
        'Authorization' => request()->header('Authorization'),
        'Content-Type' => 'application/json',
        'Access-Control-Allow-Credentials' => true,
        'Content-Disposition' => 'form-data',
        'name' => 'form-data'        
  ]
 );
}
EHF Shahab
  • 700
  • 4
  • 14