jeudi 26 avril 2018

Underscore in request header in Laravel

why laravel doesn't accept vars with underscore from request header?

I made a simple request example with a variable: "token_auth" with value 123 , but inside in my route doesn't get this value.

<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;


class Test extends Controller
{

    public function teste(Request $request){

        dd($request->header());

    }

}

only prints header with no underscore:

array:9 [
  "thisheadernounderline" => array:1 [
    0 => "312321"
  ]
  "cache-control" => array:1 [
    0 => "no-cache"
  ]
  "postman-token" => array:1 [
    0 => "3c461fd1-5bea-4100-9926-81c14cb5810c"
  ]
  "user-agent" => array:1 [
    0 => "PostmanRuntime/7.1.1"
  ]
  "accept" => array:1 [
    0 => "*/*"
  ]
  "host" => array:1 [
    0 => "localhost"
  ]
  "cookie" => array:1 [
    0 => "XSRF-TOKEN=eyJpdiI6IkJwM3pjVkFBb2hxS2d4MDFcL2srM0h3PT0iLCJ2YWx1ZSI6IiszRzhoTzV0VzN5YUkydUNUTGR5aENVd291ZW01SkZ4V2ZxQkNDTGJwbDlyMFFJZGxzNnorMkF0VUNTbHpoRndLV3FmbndJWFhkXC9cL3IzOGZvN25zN3c9PSIsIm1hYyI6IjQwZWQ1YmJhM2VjM2I3N2RiNWZlYjcwYjZmYzQ0NDk5YjkwZDc4YzRjNGQwZjQxNDVkOGU1NDU0MTA0OWI2YWYifQ%3D%3D; laravel_session=eyJpdiI6IitSckpmOFI1TmpuXC9SSUt2QVY3VlFRPT0iLCJ2YWx1ZSI6IlwvVk1EaDdYdDNxRTZLNytRcnZDTlNiaVlFTWVRVmNUOHlyVnFia0pDeE9HNWpNa3QrWlBsNnNoVEduVkhrMUhkYURoNDI4cW9RdXVHU0lIS0JZN2REQT09IiwibWFjIjoiNWJmYmJmNTdmMzJkZjQ1OGQ4NTM1NjhhMzQxNDk5NWUxOTA5OGVjOThkODkyNDgwZTA2NzEyYjFlZmE2YjVjOSJ9"
  ]
  "accept-encoding" => array:1 [
    0 => "gzip, deflate"
  ]
  "connection" => array:1 [
    0 => "keep-alive"
  ]
]

is there any workaround to solve this?

And I cant change this because this variable comes from an API (aready asked to change but they wont wanna change).

Already tried with laravel 5.4 and laravel 5.6.

ps: with simple php works fine (no laravel framework)



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2JslL6F
via IFTTT

Aucun commentaire:

Enregistrer un commentaire