Skip to content

feat: adding in http2 support#129

Merged
jaredwray merged 3 commits intomainfrom
feat-adding-in-http2-support
Mar 17, 2026
Merged

feat: adding in http2 support#129
jaredwray merged 3 commits intomainfrom
feat-adding-in-http2-support

Conversation

@jaredwray
Copy link
Copy Markdown
Owner

@jaredwray jaredwray commented Mar 17, 2026

Please check if the PR fulfills these requirements

  • Followed the Contributing and Code of Conduct guidelines.
  • Tests for the changes have been added (for bug fixes/features) with 100% code coverage.

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
feat: adding in http2 support

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the MockHttp server by integrating HTTP/2 capabilities. This feature allows the mock server to simulate modern network environments, supporting both encrypted (h2) and unencrypted (h2c) HTTP/2 connections. This is particularly beneficial for testing applications that rely on HTTP/2, such as gRPC services or browser-based interactions, providing greater flexibility and realism in mock setups.

Highlights

  • HTTP/2 Support: Introduced comprehensive HTTP/2 support, allowing the mock server to operate in both HTTP/2 over TLS (h2) and HTTP/2 cleartext (h2c) modes.
  • Configuration Options: Added new configuration options http2 to enable HTTP/2 and http1 to control HTTP/1.1 fallback when using HTTP/2 with HTTPS.
  • Environment Variable Support: Enabled HTTP/2 activation via the HTTP2 environment variable for easier deployment and testing.
  • Documentation and Testing: Updated the README.md with detailed explanations and examples for HTTP/2 usage, and added extensive test coverage for the new functionality.
Changelog
  • README.md
    • Added 'HTTP/2 Support' to the table of contents.
    • Included a new, detailed section explaining HTTP/2 support, its two modes (h2 and h2c), and configuration examples.
    • Updated the constructor options and properties documentation to reflect the new http2 and http1 parameters.
  • src/index.ts
    • Implemented logic to enable HTTP/2 support if the HTTP2 environment variable is set to 'true'.
  • src/mock-http.ts
    • Added http2 and http1 properties to the MockHttpOptions interface, along with their JSDoc comments.
    • Introduced private fields _http2 and _http1 with default values in the MockHttp class.
    • Updated the MockHttp constructor to process http2 and http1 options.
    • Added public getters and setters for http2, isHttp2, and http1 properties.
    • Modified the start method to conditionally initialize the Fastify server with HTTP/2 support, handling combinations of HTTPS and HTTP/1.1 fallback.
  • test/mock-http.test.ts
    • Added a new test suite for HTTP/2 functionality.
    • Included tests for default http2 and http1 values.
    • Added tests for setting http2 and http1 via constructor options and through getters/setters.
    • Implemented integration tests to verify server startup and response handling with HTTP/2 enabled (h2c).
    • Added integration tests for HTTP/2 with HTTPS (h2), including scenarios with and without HTTP/1.1 fallback.
    • Included tests for HTTP/2 with custom PEM certificates.
Activity
  • No specific activity (comments, reviews) found in the provided context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

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

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 adds valuable HTTP/2 support, including both h2 and h2c modes, which is a great enhancement. The changes are well-documented in the README and thoroughly tested. I have a couple of suggestions in src/mock-http.ts to improve code clarity and maintainability by removing a redundant property and refactoring the server initialization logic. Overall, this is a solid contribution.

Comment thread src/mock-http.ts Outdated
Comment thread src/mock-http.ts
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e0095d2) to head (d1da5c1).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #129   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           37        37           
  Lines         1044      1063   +19     
  Branches       208       211    +3     
=========================================
+ Hits          1044      1063   +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39a57e6455

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/mock-http.ts Outdated
@jaredwray jaredwray merged commit de400e7 into main Mar 17, 2026
7 checks passed
@jaredwray jaredwray deleted the feat-adding-in-http2-support branch March 17, 2026 15:36
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