File tree Expand file tree Collapse file tree 4 files changed +7
-9
lines changed
libraries/ESP8266WebServer Expand file tree Collapse file tree 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
110110
111111.. code :: cpp
112112
113- const String & arg();
114- const String & argName();
113+ const String & arg(int );
114+ const String & argName(int );
115115 int args();
116- bool hasArg();
116+ bool hasArg(const String& );
117117
118118 ``arg `` - get request argument value, use ``arg("plain") `` to get POST body
119119
@@ -170,7 +170,7 @@ Getting information about request path arguments
170170
171171.. code :: cpp
172172
173- const String & pathArg(unsigned int) const;
173+ const String & pathArg(int) const;
174174 int pathArgs() const;
175175
176176 ``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 {
664664}
665665
666666template <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 () )
669669 return _currentHandler->pathArg (i);
670670 return emptyString;
671671}
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ class ESP8266WebServerTemplate
141141 // Allows setting server options (i.e. SSL keys) by the instantiator
142142 ServerType &getServer () { return _server; }
143143
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
145145 int pathArgs () const ; // get path arguments count
146146
147147 const String& arg (const String& name) const ; // get request argument value by name
Original file line number Diff line number Diff line change 33
44#include < ESP8266WebServer.h>
55#include < vector>
6- #include < assert.h>
76
87namespace esp8266webserver {
98
@@ -79,7 +78,6 @@ class RequestHandler {
7978 }
8079
8180 const String& pathArg (unsigned int i) const {
82- assert (i < pathArgs.size ());
8381 return pathArgs[i];
8482 }
8583};
You can’t perform that action at this time.
0 commit comments