Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3924

Sending "Server Params" through Postman :

$
0
0

Thanks to Symfony HttpFoundation component , we can retrieve the server params like the following script :

   // retrieves SERVER variables    $request->server->get('HTTP_HOST')

So, i have the following construct and i'd like to have the server parameters :

public function __construct(RequestStack $requestStack){$request = $requestStack->getCurrentRequest();$this->country = self::DEFAULT_COUNTRY;$this->lang = self::DEFAULT_LANG;$this->brand = self::DEFAULT_BRAND;$this->jobBrand = $this->brand;if ($request) {    if (!empty($request->server->get(self::ENV_COUNTRY_CODE))) {        $this->country = $request->server->get(self::ENV_COUNTRY_CODE);    }    if (!empty($request->server->get(self::ENV_LANG_CODE))) {        $this->lang = $request->server->get(self::ENV_LANG_CODE);    }    if (!empty($request->server->get(self::ENV_BRAND))) {        $this->jobBrand = $request->server->get(self::ENV_BRAND);        $this->brand = str_replace('pro', '', $this->jobBrand);    }    if (empty($this->country) || empty($this->lang)) {        throw new NoApacheLocaleException();    }}}

For information, during the testing phase, I used Postman as an http client.

So my question is: how can I send my parameters via Postman in order to get it through $request->server->get('param') ?


Viewing all articles
Browse latest Browse all 3924


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>