1212
1313#include " HttpResource.hpp"
1414#include " HttpField.hpp"
15+ #include " HttpVersion.hpp"
1516#include " Debug.h"
1617
1718#include < Arduino.h>
1819
1920namespace ArduinoHttpServer
2021{
2122
22-
23- enum MethodEnum {MethodInvalid, MethodGet, MethodPut, MethodPost, MethodHead};
23+ enum MethodEnum
24+ {
25+ MethodInvalid, MethodGet, MethodPut, MethodPost, MethodHead
26+ };
2427
2528
2629// ------------------------------------------------------------------------------
@@ -41,7 +44,7 @@ class StreamHttpRequest
4144 // Header retrieval methods.
4245 inline const ArduinoHttpServer::HttpResource& getResource () const { return m_resource; };
4346 inline const MethodEnum getMethod () const { return m_method; };
44- inline const String & getVersion () const { return m_version; };
47+ inline const ArduinoHttpServer::HttpVersion & getVersion () const { return m_version; };
4548
4649 // Field retrieval methods.
4750 inline const String& getContentType () const { return m_contentTypeField.getValueAsString (); };
@@ -81,7 +84,7 @@ class StreamHttpRequest
8184 char m_body[MAX_BODY_SIZE ];
8285 MethodEnum m_method;
8386 ArduinoHttpServer::HttpResource m_resource;
84- String m_version;
87+ ArduinoHttpServer::HttpVersion m_version;
8588 ArduinoHttpServer::HttpField m_contentTypeField;
8689 ArduinoHttpServer::HttpField m_contentLengthField;
8790
@@ -248,7 +251,7 @@ void ArduinoHttpServer::StreamHttpRequest<MAX_BODY_LENGTH>::parseVersion()
248251 // String returns unsigned int for length.
249252 if (static_cast <unsigned int >(slashPosition) < version.length () && slashPosition > 0 )
250253 {
251- m_version = version.substring (slashPosition);
254+ m_version = HttpVersion ( version.substring (slashPosition) );
252255 }
253256 else
254257 {
0 commit comments