Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01b76646 authored by dev-12's avatar dev-12
Browse files

add support for deleted method with body

http deleted request can contain body; skipping adding the body is causing api client to fail (i.e. Nextcloud password delete api need to send body with request)
parent 3993e3fc
Loading
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
/*
 * Copyright MURENA SAS 2026
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

package com.nextcloud.android.sso;

import org.apache.commons.httpclient.methods.EntityEnclosingMethod;

public class DeleteMethodWithBody extends EntityEnclosingMethod {

    public DeleteMethodWithBody() {
        super();
    }

    public DeleteMethodWithBody(String uri) {
        super(uri);
    }

    @Override
    public String getName() {
        return "DELETE";
    }
}
+12 −1
Original line number Diff line number Diff line
@@ -300,7 +300,18 @@ public class InputStreamBinder extends IInputStreamService.Stub {
                break;

            case "DELETE":
                method = new DeleteMethod(requestUrl);
                method = new DeleteMethodWithBody(requestUrl);
                if (requestBodyInputStream != null) {
                    RequestEntity requestEntity = new InputStreamRequestEntity(requestBodyInputStream);
                    ((DeleteMethodWithBody) method).setRequestEntity(requestEntity);
                    method = new DeleteMethodWithBody(requestUrl);
                } else if (request.getRequestBody() != null) {
                    StringRequestEntity requestEntity = new StringRequestEntity(
                            request.getRequestBody(),
                            CONTENT_TYPE_APPLICATION_JSON,
                            CHARSET_UTF8);
                    ((DeleteMethodWithBody) method).setRequestEntity(requestEntity);
                }
                break;

            case "PROPFIND":