PHttpRequest.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 #include <PMap.h>
18 #include <PString.h>
19 #include <PHttpResponse.h>
20 
21 PAPILLON_BEGIN_NAMESPACE
22 
28 class PAPILLON_API_CORE PHttpRequest : public PObject
29 {
30 public:
36  explicit PHttpRequest(const PString& url);
37 
41  PHttpRequest(const PHttpRequest& other);
42 
46  virtual ~PHttpRequest();
47 
52  void FollowRedirections(bool redirections);
53 
61  void SetTimeout(papillon::uint32 timeoutMs);
62 
66  void SetInsecure(bool insecure);
67 
74  void SetCredentials(const PString& username, const PString& password);
75 
91  PResult Get(PHttpResponse& response, const PStringMap& queries = PStringMap()) const;
92 
100  PResult Post(PHttpResponse& response, const PString& data = PString::Empty(), const PString& header = PString::Empty());
101 };
102 
103 PAPILLON_END_NAMESPACE
The PString class provides an Unicode character strings.
Definition: PString.h:37
Class PHttpResponse: a class to ease processing HTTP responses.
papillon::PMap< papillon::PString, papillon::PObject > PStringMap
Definition: PMap.h:167
The PResult class represents the result returned by most of Papillon functions; this class is used to...
Definition: PResult.h:159
The PHttpRequest class ease handling HTTP requests.
Definition: PHttpRequest.h:28
Class PMap: a generic associative container (map).
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
Class PString: an unicode character strings (use copy-on-write idiom).
static const PString & Empty()
Returns the constant holding the empty string "".
Definition: PString.h:64
Class PObject: the root class of all Papillon classes.
The PHttpResponse class is used to ease processing HTTP responses.
Definition: PHttpResponse.h:27