-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Missing operators and ctors for http_request and http_response #1668
Open
evilenzo
wants to merge
2
commits into
microsoft:master
Choose a base branch
from
evilenzo:hotfix_http_assignment
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -503,6 +503,8 @@ class _http_response final : public http::details::http_msg_base | |
|
||
_http_response(http::status_code code) : m_status_code(code) {} | ||
|
||
virtual _http_response() = default; | ||
|
||
http::status_code status_code() const { return m_status_code; } | ||
|
||
void set_status_code(http::status_code code) { m_status_code = code; } | ||
|
@@ -548,6 +550,60 @@ class http_response | |
/// <returns>A new HTTP response.</returns> | ||
http_response(http::status_code code) : _m_impl(std::make_shared<details::_http_response>(code)) {} | ||
|
||
/// <summary> | ||
/// Constructs a response object | ||
/// </summary> | ||
/// <returns>A new HTTP response.</returns> | ||
http_response(const http_response& _Other) : _m_impl(_Other._m_impl) {} | ||
|
||
/// <summary> | ||
/// Constructs a response object | ||
/// </summary> | ||
/// <returns>A new HTTP response.</returns> | ||
http_response(http_response&& _Other) : _m_impl(std::move(_Other._m_impl)) {} | ||
|
||
/// <summary>Replaces the contents of one <c>http_request</c> object with another.</summary> | ||
/// <param name="_Other">The source <c>http_request</c> object.</param> | ||
/// <remarks> | ||
/// As <c>http_request</c> behaves like a smart pointer, after a copy assignment, this <c>http_request</c> | ||
/// objects represents the same actual http_request as <paramref name="_Other"/> does. | ||
/// </remarks> | ||
/// <returns>A new HTTP response.</returns> | ||
http_response& operator=(const http_response& _Other) | ||
{ | ||
if (this != &_Other) | ||
{ | ||
_m_impl = _Other._m_impl; | ||
} | ||
return *this; | ||
} | ||
|
||
/// <summary> | ||
/// Destructor frees any held resources. | ||
/// </summary> | ||
~http_response() = default; | ||
|
||
/// <summary>Replaces the contents of one <c>http_request</c> object with another.</summary> | ||
/// <param name="_Other">The source <c>http_request</c> object.</param> | ||
/// <remarks> | ||
/// As <c>http_request</c> behaves like a smart pointer, after a copy assignment, this <c>http_request</c> | ||
/// objects represents the same actual http_request as <paramref name="_Other"/> does. | ||
/// </remarks> | ||
/// <returns>A new HTTP response.</returns> | ||
http_response& operator=(http_response&& _Other) | ||
{ | ||
if (this != &_Other) | ||
{ | ||
_m_impl = std::move(_Other._m_impl); | ||
} | ||
return *this; | ||
} | ||
|
||
/// <summary> | ||
/// Destructor frees any held resources. | ||
/// </summary> | ||
~http_response() = default; | ||
|
||
/// <summary> | ||
/// Gets the status code of the response message. | ||
/// </summary> | ||
|
@@ -853,7 +909,7 @@ class _http_request final : public http::details::http_msg_base, public std::ena | |
|
||
_ASYNCRTIMP _http_request(std::unique_ptr<http::details::_http_server_context> server_context); | ||
|
||
virtual ~_http_request() {} | ||
virtual ~_http_request() = default; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? |
||
|
||
http::method& method() { return m_method; } | ||
|
||
|
@@ -951,10 +1007,67 @@ class http_request | |
/// <param name="mtd">Request method.</param> | ||
http_request(http::method mtd) : _m_impl(std::make_shared<http::details::_http_request>(std::move(mtd))) {} | ||
|
||
/// <summary> | ||
/// Constructs a <c>http_request</c> object. | ||
/// </summary> | ||
/// <param name="_Other"> | ||
/// The source <c>http_request</c> object. | ||
/// </param> | ||
http_request(const http_request& _Other) : _m_impl(_Other._m_impl) {} | ||
|
||
/// <summary> | ||
/// Constructs a <c>http_request</c> object. | ||
/// </summary> | ||
/// <param name="_Other"> | ||
/// The source <c>http_request</c> object. | ||
/// </param> | ||
http_request(http_request&& _Other) : _m_impl(_Other._m_impl) {} | ||
|
||
|
||
/// <summary> | ||
/// Replaces the contents of one <c>http_request</c> object with another. | ||
/// </summary> | ||
/// <param name="_Other"> | ||
/// The source <c>http_request</c> object. | ||
/// </param> | ||
/// <remarks> | ||
/// As <c>http_request</c> behaves like a smart pointer, after a copy assignment, this <c>http_request</c> | ||
/// objects represents the same actual http_request as <paramref name="_Other"/> does. | ||
/// </remarks> | ||
/**/ | ||
http_request& operator=(const http_request& _Other) | ||
{ | ||
if (this != &_Other) | ||
{ | ||
_m_impl = _Other._m_impl; | ||
} | ||
return *this; | ||
} | ||
|
||
/// <summary> | ||
/// Replaces the contents of one <c>http_request</c> object with another. | ||
/// </summary> | ||
/// <param name="_Other"> | ||
/// The source <c>http_request</c> object. | ||
/// </param> | ||
/// <remarks> | ||
/// As <c>http_request</c> behaves like a smart pointer, after a copy assignment, this <c>http_request</c> | ||
/// objects represents the same actual http_request as <paramref name="_Other"/> does. | ||
/// </remarks> | ||
/**/ | ||
http_request& operator=(http_request&& _Other) | ||
{ | ||
if (this != &_Other) | ||
{ | ||
_m_impl = std::move(_Other._m_impl); | ||
} | ||
return *this; | ||
} | ||
|
||
/// <summary> | ||
/// Destructor frees any held resources. | ||
/// </summary> | ||
~http_request() {} | ||
~http_request() = default; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again not needed |
||
|
||
/// <summary> | ||
/// Get the method (GET/PUT/POST/DELETE) of the request message. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These don't appear to do anything over just accepting the compiler's defaults. The original class has an empty destructor, which is somewhat redundant, not an excuse to add even more redundant stuff