CircleOfNice / CiRestClientBundle

Mapper for PHP internal curl library
GNU General Public License v3.0
57 stars 20 forks source link

Opened API for deprecated HTTP method calls #24

Closed TobiasHauck closed 9 years ago

TobiasHauck commented 9 years ago

There are some HTTP methods that are deprecated. We cannot provide them in this bundle because we are not able to test them properly. So if you want to use HTTP methods like LINK or UNLINK you can now extend the RestClient service and add these methods by yourself.

namespace Acme\MyBundle\Services;

use Ci\RestClientBundle\Services;

ExtendendRestClient extends RestClient {
    /**
     * {@inheritdoc}
     */
    public function link($url, array $options = array()) {
        return $this->curl->sendRequest($url, 'LINK', $options);
    }

    /**
     * {@inheritdoc}
     */
    public function unlink($url, array $options = array()) {
        return $this->curl->sendRequest($url, 'UNLINK', $options);
    }
}

Afterwards override the parameter "ci.restclient.class" in your applications parameters configuration with your new one (in this case "Acme\MyBundle\Services\ExtendedRestClient").

parameters:
    ci.restclient.class: Acme\MyBundle\Services\ExtendedRestClient
Chroq commented 9 years ago

Thank you, Tobias, I'll do that.

Just for me, LINK/UNLINK methods are really deprecated ?

TobiasHauck commented 9 years ago

Yes they are some kind of deprecated.

http://tools.ietf.org/id/draft-snell-link-method-01.html

"These were originally defined as "additional request methods" that were later dropped entirely from follow-on iterations of the HTTP specification due to previous lack of interest or use."

Chroq commented 9 years ago

Indeed... I'll see if I can eventually change them for something else.

By the way, thank you very much !

TobiasHauck commented 9 years ago

No problem. Thank you for supporting us!