Skip to content

Bug: appendHeader 500 error if header does not exist #2730

Description

@najdanovicivan

Describe the bug
Setting non existent header using appendHeader method returns 500 error.

CodeIgniter 4 version
develop 84b9cc7

Affected module(s)
CodeIgniter\HTTP\Message

Expected behavior, and steps to reproduce if appropriate
I'm trying to implement HTTP2 Push using HTTP Link header so i'm setting links of my stylesheet and JS using appendHeader method like this:

$response->appendHeader('Link', '<' . $asset . '>; rel=preload;  as=style');

If I set the first Link header using setHeader method and call appendHeader after that everything works as supposed

Imo appendHeader should call the setHeader method if header is not already preset. I'll submit PR for this one

Context

  • OS: MacOS Mojave
  • Web server Apache 2
  • PHP version 7.4.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions