Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking Change: Version 8.0.0 #27

Merged
merged 23 commits into from
Jan 25, 2024
Merged

Breaking Change: Version 8.0.0 #27

merged 23 commits into from
Jan 25, 2024

Conversation

andrewlalis
Copy link
Owner

@andrewlalis andrewlalis commented Jan 22, 2024

In this update, I am refactoring the HttpRequest's headers and queryParams to use a newly-introduced MultiValueMap type instead of associative arrays or arrays of QueryParam. This is inspired by Vibe's DictionaryList, and should help to make these properties easier to work with.

I'm also incorporating lots of other small improvements to the API to make it more intuitive.

Here's a list of changes as I accumulate them:

HttpRequest

  • HttpRequest.headers is now a StringMultiValueMap.
  • HttpRequest.queryParams is now a StringMultiValueMap.
  • Removed the deprecated HttpRequest.params associative array of query params.
  • Removed HttpRequest.hasHeader(string) and HttpRequest.getHeader(string).
  • Publicly imported handy_httpd.components.multipart in HttpRequest to provide immediate access to readBodyAsMultipartFormData as an additional way to read the request body.

HttpRequestContext

  • Added aliases req and resp to HttpRequestContext to refer to the request and response, respectively.

Handlers

  • Removed the deprecated PathDelegatingHandler. Only the PathHandler is supported from now on.

Worker Pool

  • Refactored worker pool architecture to use a pluggable RequestWorkerPool interface, and added previous implementation as LegacyWorkerPool, as well as a TaskPoolWorkerPool based on std.parallelism.
  • Extracted request parsing and processing logic from legacy worker thread to top-level functions, so they can be used in any worker pool implementation.

Configuration

  • Made ServerConfig.enableWebSockets default to false instead of true.

Examples

  • Completely refactored the layout of examples, and made most examples single D files in the main examples directory.
  • Added a functional runner script that can be used to run the examples.

@andrewlalis andrewlalis changed the title Breaking Change: Use MultiValueMap instead of associative arrays for request headers and query params Breaking Change: Version 8.0.0 Jan 24, 2024
@andrewlalis andrewlalis merged commit be24418 into main Jan 25, 2024
27 checks passed
@andrewlalis andrewlalis deleted the use-multivalue-map branch January 25, 2024 01:08
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