Skip to content

feat: add RunFunctionsOptions for server configuration#202

Merged
demolaf merged 6 commits into
mainfrom
feat/run-functions-options
Jun 19, 2026
Merged

feat: add RunFunctionsOptions for server configuration#202
demolaf merged 6 commits into
mainfrom
feat/run-functions-options

Conversation

@demolaf

@demolaf demolaf commented Jun 4, 2026

Copy link
Copy Markdown
Member

Closes #120.

Adds a RunFunctionsOptions class to runFunctions, starting with poweredByHeader to allow users to remove or customize the x-powered-by response header.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces RunFunctionsOptions to allow configuring runtime options for runFunctions, specifically the x-powered-by response header. It also adds corresponding unit tests. A review comment suggests removing a redundant import of RunFunctionsOptions in the test file, as it is already available via the direct import of src/server.dart.

Comment thread test/unit/server_test.dart Outdated
@demolaf demolaf force-pushed the feat/run-functions-options branch from 6cd2d20 to 169e443 Compare June 4, 2026 12:06
@demolaf demolaf requested review from Lyokone and kevmoo June 4, 2026 12:06
Comment thread lib/src/server.dart Outdated
Comment thread lib/src/server.dart
typedef FunctionsRunner = FutureOr<void> Function(Firebase firebase);

/// Runtime configuration options for [runFunctions].
class RunFunctionsOptions {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we handle this for other SDKs and are we being consistent?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other SDKs don't provide support for overriding the default X-Powered-By header, so this is purely an addition to the dart SDK.

Do we want to add support for this?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine. We added default support for x-powered-by to shelf, but folks want to be able to remove it.

@kevmoo

kevmoo commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

/gemini review

@kevmoo kevmoo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern is creating a whole new object for ONE property.

Do we think we'll have more in the future?

Would it be better to just add one optional param to runFunctions now and avoid making things complicated until we know we need to?

Comment thread lib/src/server.dart
typedef FunctionsRunner = FutureOr<void> Function(Firebase firebase);

/// Runtime configuration options for [runFunctions].
class RunFunctionsOptions {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine. We added default support for x-powered-by to shelf, but folks want to be able to remove it.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces RunFunctionsOptions to allow configuring runtime options for runFunctions, specifically enabling customization of the x-powered-by response header via poweredByHeader. Unit tests were added to verify this behavior. A review comment points out that the test verifying explicit null input for poweredByHeader is identical to the default constructor test, and suggests explicitly passing null to properly test this scenario.

Comment thread test/unit/server_test.dart Outdated
@demolaf

demolaf commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

My only concern is creating a whole new object for ONE property.

Do we think we'll have more in the future?

Would it be better to just add one optional param to runFunctions now and avoid making things complicated until we know we need to?

yes this makes sense but x-powered-by is not a behavior of runFunctions itself but instead the underlying server so having RunFunctionsOptions to signal this might be better?

@demolaf demolaf force-pushed the feat/run-functions-options branch from c5bd0b5 to c0fb73e Compare June 19, 2026 11:22
@demolaf demolaf merged commit c79d074 into main Jun 19, 2026
18 checks passed
@demolaf demolaf deleted the feat/run-functions-options branch June 19, 2026 11:38
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.

Add ability to globally customize x-powered-by header

4 participants