Skip to content

Commit

Permalink
feat(Utils): add normalizeHttpOptions method
Browse files Browse the repository at this point in the history
- Added new method `normalizeHttpOptions` to Utils class
- Method normalizes HTTP options array by handling multipart data
  • Loading branch information
guanguans committed Jul 10, 2024
1 parent be01512 commit 906d848
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Foundation/Support/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@ public static function mergeHttpOptions(array $originalOptions, array ...$option
);
}

public static function normalizeHttpOptions(array $httpOptions, int $options = MULTIPART_TRY_OPEN_FILE): array
{
if (isset($httpOptions[RequestOptions::MULTIPART])) {
$httpOptions[RequestOptions::MULTIPART] = self::multipartFor(
$httpOptions[RequestOptions::MULTIPART],
$options,
);
}

return $httpOptions;
}

/**
* @param array<string, scalar> $agents
*/
Expand Down

0 comments on commit 906d848

Please sign in to comment.