Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

QTweetFriendshipDestroy::unfollow #9

Open
DmitryRizshkovg opened this Issue Mar 5, 2011 · 1 comment

Comments

Projects
None yet
2 participants

Works incorrect

should have a body

if (!isAuthenticationEnabled()) {
qCritical("Needs authentication to be enabled");
return;
}

QUrl url("http://api.twitter.com/1/friendships/destroy.json");

QUrl urlQuery(url);

urlQuery.addQueryItem("screen_name", QUrl::toPercentEncoding(screenName));

if (includeEntities)
{
    urlQuery.addQueryItem("include_entities", "true");
}

QNetworkRequest req(url);

QByteArray oauthHeader = oauthTwitter()->generateAuthorizationHeader(urlQuery, OAuth::POST);
req.setRawHeader(AUTH_HEADER, oauthHeader);

QByteArray postBody = urlQuery.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemovePath);
postBody.remove(0, 1);

QNetworkReply *reply = oauthTwitter()->networkAccessManager()->post(req, postBody);
connect(reply, SIGNAL(finished()), this, SLOT(reply()));
Owner

minimoog commented Mar 6, 2011

This should be more proper:

QByteArray oauthHeader = oauthTwitter()->generateAuthorizationHeader(url, OAuth::DELETE);

Anyway your code will work also!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment