contributte / apitte

:wrench: An opinionated and enjoyable API framework based on Nette Framework. Supporting content negotiation, debugging, middlewares, attributes, annotations and loving openapi/swagger.
https://contributte.org/packages/contributte/apitte/
MIT License
61 stars 36 forks source link

Nginx error - duplicate header 'Content-Type' #20

Closed mkopacek closed 6 years ago

mkopacek commented 6 years ago

Řešením je úprava funkce

    /**
     * @param string $name
     * @param array $values
     * @return void
     */
    protected function sendHeader($name, $values)
    {
        $name = str_replace('-', ' ', $name);
        $name = ucwords($name);
        $name = str_replace(' ', '-', $name);
        foreach ($values as $value) {
            header(sprintf('%s: %s', $name, $value), $name == "Content-Type");
        }
    }
f3l1x commented 6 years ago

Thanks. It looks like you add more then one Content-Type header? Could you prove it?

mabar commented 6 years ago

Welcome at github.

First of all - please write english-only here. Other developers read these issues too and not many of us speak czech too. Don't worry, if your english is not much good. Without trying is no improvement.

Always make sure issue is reported into right repository. This is not apitte issue, but contributte/psr7-http-message issue.

If you know how to fix an bug, send PR and make sure all tests passes. Your issue will be more likely fixed and will be fixed earlier.

We think you sent Content-Type header more then once. It should not happen and it's up to you to ensure it cannot happen.

Please, don't take my words negatively. Following these rules just makes our lives easier and there is nothing bad if you cannot do everything I wrote.

enumag commented 6 years ago

@mabar Alright, let's improve your english too. :-P

Welcome to github.

Without trying there is no improvement.

If you know how to fix a bug

We think you sent Content-Type header more than once.

mabar commented 6 years ago

I know, it's not perfect xD Thx