Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

Missing Request Mime types #168

Open
N-Schaef opened this issue May 6, 2020 · 2 comments
Open

Missing Request Mime types #168

N-Schaef opened this issue May 6, 2020 · 2 comments

Comments

@N-Schaef
Copy link

N-Schaef commented May 6, 2020

Hello,

the slack API requires that requests set the correct mime types, like application/json.
This library does not yet do so. (See for example Incoming Webhook)

The slack API does not (yet) enforce this. But the slack compatible mattermost API recently started doing so, which means this library does not work with mattermost anymore.

@mortanius-1
Copy link

Hey just a heads up the fix is relatively trivial to implement if you get the time to implement and push upstream please review lines:

slacker/slacker/__init__.py

Lines 1182 to 1183 in ec39f34

return requests.post(self.url, data=json.dumps(data),
timeout=self.timeout, proxies=self.proxies)

Set the headers in the post request: headers={'content-type': 'application/json'}, example change:

return requests.post(self.url, data=json.dumps(data),
                             timeout=self.timeout, proxies=self.proxies, 
                             headers={'content-type': 'application/json'})

@mortanius-1
Copy link

Hey @N-Schaef Mattermost have release a new version: 5.23.1 that fixes this issue.

Detail:
Modified the mime check, such that we now require Content-Type to be set in the request header.
This change was unintentional and led to breaking changes.

See issue: https://mattermost.atlassian.net/plugins/servlet/mobile?originPath=%2Fbrowse%2FMM-25677#issue/MM-25677

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants