Class: QgsBufferServerResponse¶
-
class
qgis.server.
QgsBufferServerResponse
¶ Bases:
qgis._server.QgsServerResponse
Class defining buffered response
New in version 3.0: Enums
Methods
Returns body
Reset all headers and content for this response
Gets the data written so far
Finish the response, ending the transaction
Flushes the current output buffer to the network
Returns the header value
Returns all the headers
Returns true if the headers have already been sent
Returns the underlying QIODevice
Clear header Undo a previous ‘setHeader’ call
Send error This method delegates error handling at the server level.
Set Header entry Add Header entry to the response Note that it is usually an error to set Header after data have been sent through the wire
Set the http status code
Returns the http status code
Truncate data
Signals
Attributes
-
body
(self) → QByteArray¶ Returns body
-
clear
(self)¶ Reset all headers and content for this response
-
data
(self) → QByteArray¶ Gets the data written so far
This is implementation dependent: some implementations may not give access to the underlying and return an empty array.
Note that each call to ‘flush’ may empty the buffer and in case of streaming process you may get partial content
-
finish
(self)¶ Finish the response, ending the transaction
-
flush
(self)¶ Flushes the current output buffer to the network
‘flush()’ may be called multiple times. For HTTP transactions headers will be written on the first call to ‘flush()’.
-
header
(self, key: str) → str¶ Returns the header value
-
headers
(self) → Dict[str, str]¶ Returns all the headers
-
headersSent
(self) → bool¶ Returns true if the headers have already been sent
-
io
(self) → QIODevice¶ Returns the underlying QIODevice
-
removeHeader
(self, key: str)¶ Clear header Undo a previous ‘setHeader’ call
-
sendError
(self, code: int, message: str)¶ Send error This method delegates error handling at the server level. This is different from calling setReturnCode() which let you return a specific response body. Calling sendError() will end the transaction and any attempt to write data or set headers will be an error.
- Parameters
code – HHTP return code value
message – An informative error message
-
setHeader
(self, key: str, value: str)¶ Set Header entry Add Header entry to the response Note that it is usually an error to set Header after data have been sent through the wire
-
setStatusCode
(self, code: int)¶ Set the http status code
- Parameters
code – HTTP status code value
-
statusCode
(self) → int¶ Returns the http status code
-
truncate
(self)¶ Truncate data
Clear internal buffer
-