QOAuth2AuthorizationCodeFlow PATCH request
Unsolved
General and Desktop
-
Hi,
With QOAuth2AuthorizationCodeFlow I can send authenticated GET, PUT, DELETE and HEAD requests. But no PATCH.
Is there a way to do that?
I need to call [1] with a request body.[1] https://developers.google.com/drive/api/v3/reference/files/update
-
Hi,
From the looks of it, you would have to modify the QtNetworkAuth module and add support for it.
If you do that, please consider submitting a patch for inclusion :-)
-
Thousands of years ago I tried to submit a PR with no success.
How to submit a patch these days? Is there a tutorial or something like this?
-
-
-
@SGaist thank you
@raven-worx thank youAs a workaround and for future reference:
// in the header QOAuth2AuthorizationCodeFlow oauth2; .... QNetworkRequest request; request.setUrl(QUrl{ QString{ "https://www.googleapis.com/drive/v3/files/%1?supportsAllDrives=true" }.arg(fileId) }); request.setRawHeader(QByteArray{ "Authorization" }, QString{ "Bearer %1" }.arg(oauth2.token()).toUtf8() ); request.setHeader(QNetworkRequest::ContentTypeHeader, QString{ "application/json; charset=UTF-8" }.toUtf8()); request.setHeader(QNetworkRequest::ContentLengthHeader, QString{ "19" }.toUtf8()); QBuffer *buff = new QBuffer; buff->open(QIODevice::ReadWrite); buff->write(QString{ "{ \"trashed\": true }" }.toUtf8()); buff->seek(0); oauth2.networkAccessManager()->sendCustomRequest(request, "PATCH", buff);