Skip to content

Conversation

@Alejandro-FA
Copy link

Description

The current option for customizing response headers is very limited, as demonstrated by #63 and #22. This pull request adds the possibility of specifying path-specific headers using a file (with the new --headersfile option).

Design

The goal is to enable the possibility of testing complex headers behavior in a local environment. To this end, I have focused on adding support for two "real-world" header file formats:

Each of these formats uses a glob pattern-mathing system to specify the paths to which the headers should be applied. Additional file formats could be added in the future with minimal effort.

Additional notes

  • I have added a new dependency to the project: glob. This package is used to match the paths in the header files.
  • I have added a new test: headers_test.dart. It tests header parsing.
  • I have added two example header files: sample/_headers and sample/headers.json. These files are also used in the tests.
  • I have taken the liberty of including PR Update regular expression for header flag #63, as it is a very small change and it is closely related.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant