Skip to content

refactor(http): return Option<&str> from HttpMessage::content_type - #4229

Draft
Sruhvx-jpg wants to merge 1 commit into
actix:mainfrom
Sruhvx-jpg:refactor/http-message-content-type
Draft

refactor(http): return Option<&str> from HttpMessage::content_type#4229
Sruhvx-jpg wants to merge 1 commit into
actix:mainfrom
Sruhvx-jpg:refactor/http-message-content-type

Conversation

@Sruhvx-jpg

@Sruhvx-jpg Sruhvx-jpg commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

PR Type

Refactor

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt.

Overview

Returns Option<&str> from HttpMessage::content_type() instead of an empty string sentinel, and updates UrlEncoded and tests to match.

Supersedes #3827. Closes #3797.

Update HttpMessage::content_type to return Option<&str> instead of &str,
avoiding empty string sentinels. Update UrlEncoded extractor and tests
accordingly.

Closes actix#3797
@github-actions github-actions Bot added A-http project: actix-http A-web project: actix-web labels Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-http project: actix-http A-web project: actix-web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change HttpRequest::content_type to return Option<&str>

1 participant