Edujugon / PushNotification

PHP and Laravel Package to send push notifications to Android and IOS devices.
MIT License
478 stars 159 forks source link

Content-Type:" is not valid header name #140

Open chandanjha opened 3 years ago

toyomsk commented 3 years ago

Same thing, error in:

protected function addRequestHeaders() { return [ 'Authorization' => 'key=' . $this->config['apiKey'], 'Content-Type:' =>'application/json' ]; }

Solve:

protected function addRequestHeaders() { return [ 'Authorization' => 'key=' . $this->config['apiKey'], 'Content-Type' =>'application/json' ]; }

moxerox commented 3 years ago

Same thing, error in:

protected function addRequestHeaders() { return [ 'Authorization' => 'key=' . $this->config['apiKey'], 'Content-Type:' =>'application/json' ]; }

Solve:

protected function addRequestHeaders() { return [ 'Authorization' => 'key=' . $this->config['apiKey'], 'Content-Type' =>'application/json' ]; }

Yes this is the solution to this error. You should find this in vendor\edujugon\push-notification\src\Gcm.php

Humza01 commented 2 years ago

Any ideas @toyomsk @moxerox as to why this issue is being generated and what is the culprit behind it?

mahmoudebakers commented 2 years ago

is this problem solved ?

moxerox commented 2 years ago

@Humza01 it is because of the content type index, it should be "Content-Type", while in the original code it is "Content-Type:". So the problem is with the ending colon.

moxerox commented 2 years ago

is this problem solved ?

so no its not fixed yet, but you can manually adjust it and make a PR