Requests icon indicating copy to clipboard operation
Requests copied to clipboard

URI Too Long

Open nathan30 opened this issue 7 years ago • 1 comments

Hi, I'm using your lib to connect a Wordpress and a personnal application. The wordpress could send some attachments encoded in B64. So i'm using a WS using post() but the parameters are passed like in a GET request and throw me the 414 URI Too Long error

Here is a piece of my code :

$options = array(
                'auth'        => new Requests_Auth_Basic(array($cfg['user'], $cfg['pass'])),
                'data_format' => 'query'
    );
 $storeAttachmentResourceParams = array(
            'encodedFile'   => $PJ['content'],
            'resId'         => $resId,
            'data'          => array(
                                        array('column' => 'title', 'value' => 'PJ', 'type' => 'string'),
                                        array('column' => 'attachment_type', 'value' => 'simple_attachment', 'type' => 'string'),
                                        array('column' => 'status', 'value' => 'A_TRA', 'type' => 'string'),
                                      ),
            'collId'        => 'letterbox_coll',
            'collIdMaster'  => 'letterbox_coll',
            'table'         => 'res_attachments',
            'fileFormat'    => $ext

$storeAttachmentResource = Requests::post($cfg['url'] . '/attachments', array(), $storeAttachmentResourceParams, $options)

nathan30 avatar Oct 02 '18 09:10 nathan30

data_format should be body not query, as per the docs: http://requests.ryanmccue.info/api/source-class-Requests.html#344

soulseekah avatar Oct 02 '18 10:10 soulseekah