Rename wxWebSession::SetHeader() to AddCommonHeader()

The old name wasn't very clear and it was confusing to have methods with
the same name in wxWebSession and wxWebRequest.
This commit is contained in:
Vadim Zeitlin
2021-01-11 03:02:25 +01:00
parent 76167e271b
commit 4986850c63
4 changed files with 9 additions and 6 deletions

View File

@@ -205,7 +205,7 @@ public:
virtual wxVersionInfo GetLibraryVersionInfo() = 0; virtual wxVersionInfo GetLibraryVersionInfo() = 0;
void SetHeader(const wxString& name, const wxString& value) void AddCommonHeader(const wxString& name, const wxString& value)
{ m_headers[name] = value; } { m_headers[name] = value; }
void SetTempDir(const wxString& dir) { m_tempDir = dir; } void SetTempDir(const wxString& dir) { m_tempDir = dir; }

View File

@@ -220,7 +220,7 @@ public:
wxVersionInfo GetLibraryVersionInfo(); wxVersionInfo GetLibraryVersionInfo();
void SetHeader(const wxString& name, const wxString& value); void AddCommonHeader(const wxString& name, const wxString& value);
void SetTempDir(const wxString& dir); void SetTempDir(const wxString& dir);
wxString GetTempDir() const; wxString GetTempDir() const;

View File

@@ -581,10 +581,13 @@ public:
A good example for a session-wide request header is the @c User-Agent A good example for a session-wide request header is the @c User-Agent
header. header.
Calling this function with the same header name again replaces the
previously used value.
@param name Name of the header @param name Name of the header
@param value String value of the header @param value String value of the header
*/ */
void SetHeader(const wxString& name, const wxString& value); void AddCommonHeader(const wxString& name, const wxString& value);
/** /**
Override the default temporary directory that may be used by the Override the default temporary directory that may be used by the

View File

@@ -773,7 +773,7 @@ wxStringWebSessionFactoryMap gs_factoryMap;
wxWebSessionImpl::wxWebSessionImpl() wxWebSessionImpl::wxWebSessionImpl()
{ {
// Initialize the user-Agent header with a reasonable default // Initialize the user-Agent header with a reasonable default
SetHeader("User-Agent", wxString::Format("%s/1 wxWidgets/%d.%d.%d", AddCommonHeader("User-Agent", wxString::Format("%s/1 wxWidgets/%d.%d.%d",
wxTheApp->GetAppName(), wxTheApp->GetAppName(),
wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER)); wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER));
} }
@@ -889,11 +889,11 @@ wxVersionInfo wxWebSession::GetLibraryVersionInfo()
return m_impl->GetLibraryVersionInfo(); return m_impl->GetLibraryVersionInfo();
} }
void wxWebSession::SetHeader(const wxString& name, const wxString& value) void wxWebSession::AddCommonHeader(const wxString& name, const wxString& value)
{ {
wxCHECK_IMPL_VOID(); wxCHECK_IMPL_VOID();
m_impl->SetHeader(name, value); m_impl->AddCommonHeader(name, value);
} }
void wxWebSession::SetTempDir(const wxString& dir) void wxWebSession::SetTempDir(const wxString& dir)