node:http improvements (#17093)

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Pham Minh Triet <92496972+Nanome203@users.noreply.github.com>
Co-authored-by: snwy <snwy@snwy.me>
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
Co-authored-by: cirospaciari <cirospaciari@users.noreply.github.com>
Co-authored-by: Ben Grant <ben@bun.sh>
This commit is contained in:
Kai Tamkun
2025-03-10 20:19:29 -07:00
committed by GitHub
parent 013fdddc6e
commit 4a0e982bb2
83 changed files with 6236 additions and 1888 deletions

View File

@@ -268,6 +268,10 @@ pub const String = extern struct {
/// They're de-duplicated in a threadlocal hash table
/// They cannot be used from other threads.
pub fn createAtomIfPossible(bytes: []const u8) String {
if (bytes.len == 0) {
return String.empty;
}
if (bytes.len < 64) {
if (tryCreateAtom(bytes)) |atom| {
return atom;