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

Options Http Enum add to Core #5246

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/core/azure-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 1.11.0-beta.3 (Unreleased)

- Added 'OPTIONS' HTTP method to `Azure::Core::Http::HttpMethod` enum.

### Features Added

### Breaking Changes
Expand Down
6 changes: 6 additions & 0 deletions sdk/core/azure-core/inc/azure/core/http/http.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ namespace Azure { namespace Core { namespace Http {
*/
AZ_CORE_DLLEXPORT const static HttpMethod Patch;

/**
* @brief The representation of an `OPTIONS` HTTP method based on [RFC 2616]
* (https://datatracker.ietf.org/doc/html/rfc2616).
*/
AZ_CORE_DLLEXPORT const static HttpMethod Options;

private:
std::string m_value;
}; // extensible enum HttpMethod
Expand Down
1 change: 1 addition & 0 deletions sdk/core/azure-core/src/http/http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const HttpMethod HttpMethod::Post("POST");
const HttpMethod HttpMethod::Put("PUT");
const HttpMethod HttpMethod::Delete("DELETE");
const HttpMethod HttpMethod::Patch("PATCH");
const HttpMethod HttpMethod::Options("OPTIONS");
Copy link
Member

@ahsonkhan ahsonkhan Jan 11, 2024

Choose a reason for hiding this comment

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

An alternative stop-gap solution to adding this in core, is to just use the "OPTIONS" string. HttpMethod is an extensible enum which supports constructing from any string and is designed exactly for such scenarios.

See details here: #5137 (comment)


namespace {
bool IsInvalidHeaderNameChar(char c)
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/azure-core/test/libcurl-stress-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Where namespace will be created if missing , search directory can be any folder

ATM the docker image is build by hand and hard-coded in the chart to simplify matters.

To build the image run "docker build -t <acr>/azuresdkforcpp/curlstress:v8 --build-arg targetTest=azure-core-libcurl-stress-test --build-arg build=on ."
To build the image run "docker build -t <acr>/azuresdkforcpp/curlstress:v8 --build-arg targetTest=azure-core-libcurl-stress-test --build-arg build=on -f .\Dockerfile .\..\..\..\..\..\"

To push to mcr : "docker push <acr>/azuresdkforcpp/curlstress:v8"
Obviously after logging in to the acr "az acr login -n <acr>"
Expand Down