its-rigs/Trolly

Use body instead of query_params for PUT and POST requests

Closed this issue · 1 comments

wolph commented

RIght now some (all?) of the PUT and POSt requests use query parameters to send the values, with large values that can cause errors since the url becomes too long. I propose changing them to json bodies instead.

For example, in the case of the update_card method in card.py:

def update_card(self, query_params=None):
    '''
    Update information for this card. Returns a new Card object.
    '''
    card_json = self.fetch_json(
        uri_path=self.base_uri,
        http_method='PUT',
        body=json.dumps(query_params),
    )
    return self.create_card(card_json)

Works fine except that it accepts much more data :)

Yeah good point. Been a while since I did any major work on this. My plan is to start separating this out a bit more, starting with the http requests, so I'll abstract this out then.