File tree 4 files changed +7
-9
lines changed
libraries/ESP8266WebServer
4 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -110,10 +110,10 @@ Getting information about request arguments
110
110
111
111
.. code :: cpp
112
112
113
- const String & arg();
114
- const String & argName();
113
+ const String & arg(int );
114
+ const String & argName(int );
115
115
int args();
116
- bool hasArg();
116
+ bool hasArg(const String& );
117
117
118
118
``arg `` - get request argument value, use ``arg("plain") `` to get POST body
119
119
@@ -170,7 +170,7 @@ Getting information about request path arguments
170
170
171
171
.. code :: cpp
172
172
173
- const String & pathArg(unsigned int) const;
173
+ const String & pathArg(int) const;
174
174
int pathArgs() const;
175
175
176
176
``pathArg `` - get request path argument by index (starting with 0)
Original file line number Diff line number Diff line change @@ -664,8 +664,8 @@ int ESP8266WebServerTemplate<ServerType>::pathArgs() const {
664
664
}
665
665
666
666
template <typename ServerType>
667
- const String& ESP8266WebServerTemplate<ServerType>::pathArg(unsigned int i) const {
668
- if (_currentHandler != nullptr )
667
+ const String& ESP8266WebServerTemplate<ServerType>::pathArg(int i) const {
668
+ if (i >= 0 && _currentHandler != nullptr && i < _currentHandler-> pathArgsSize () )
669
669
return _currentHandler->pathArg (i);
670
670
return emptyString;
671
671
}
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ class ESP8266WebServerTemplate
141
141
// Allows setting server options (i.e. SSL keys) by the instantiator
142
142
ServerType &getServer () { return _server; }
143
143
144
- const String& pathArg (unsigned int i) const ; // get request path argument by number
144
+ const String& pathArg (int i) const ; // get request path argument by number
145
145
int pathArgs () const ; // get path arguments count
146
146
147
147
const String& arg (const String& name) const ; // get request argument value by name
Original file line number Diff line number Diff line change 3
3
4
4
#include < ESP8266WebServer.h>
5
5
#include < vector>
6
- #include < assert.h>
7
6
8
7
namespace esp8266webserver {
9
8
@@ -79,7 +78,6 @@ class RequestHandler {
79
78
}
80
79
81
80
const String& pathArg (unsigned int i) const {
82
- assert (i < pathArgs.size ());
83
81
return pathArgs[i];
84
82
}
85
83
};
You can’t perform that action at this time.
0 commit comments