Skip to content

Commit 1fc1d94

Browse files
committed
Fix auth and request body errors
1 parent 6de2dfc commit 1fc1d94

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

plugins/backend/feedbin/feedbinAPI.vala

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,6 @@ public class FeedbinAPI : Object {
4242
{
4343
m_session.user_agent = user_agent;
4444
}
45-
46-
m_session.authenticate.connect(authenticate);
47-
}
48-
49-
~FeedbinAPI()
50-
{
51-
m_session.authenticate.disconnect(authenticate);
52-
}
53-
54-
private void authenticate(Soup.Message msg, Soup.Auth auth, bool retrying)
55-
{
56-
if(!retrying)
57-
{
58-
auth.authenticate(this.username, this.password);
59-
}
6045
}
6146

6247
private Soup.Message request(string method, string last_part, string? input = null) throws FeedbinError
@@ -68,14 +53,19 @@ public class FeedbinAPI : Object {
6853
var path = m_base_uri + last_part;
6954
var message = new Soup.Message(method, path);
7055

71-
if(method == "POST")
72-
{
56+
message.authenticate.connect((auth, retrying) => {
57+
if (!retrying) {
58+
auth.authenticate(this.username, this.password);
59+
}
60+
});
61+
62+
if (method == "POST") {
7363
message.request_headers.append("Content-Type", "application/json; charset=utf-8");
7464
}
7565

76-
if(input != null)
77-
{
78-
message.request_body.append_take(input.data);
66+
if (input != null) {
67+
// TODO: Figure out MIME type and replace null with it
68+
message.set_request_body_from_bytes (null, new Bytes (input.data));
7969
}
8070

8171
m_session.send_and_read(message);

0 commit comments

Comments
 (0)