Skip to content

Instantly share code, notes, and snippets.

@soplakanets
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soplakanets/9834322 to your computer and use it in GitHub Desktop.
Save soplakanets/9834322 to your computer and use it in GitHub Desktop.
Mailgun Response Content-type inconsistency

A call to create a mailing list responds with text/html content type.

~ → curl -i -s --user 'api:key-...' --data 'name=TestCampaign' -X POST 'https://api.mailgun.net/v2/sandbox67449.mailgun.org/campaigns'
HTTP/1.1 200 OK
Server: nginx/1.4.1
Date: Fri, 28 Mar 2014 14:27:26 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 302
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 600
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type, x-requested-with

{"message": "Campaign created", "campaign": {"clicked_count": 0, "opened_count": 0, "submitted_count": 0, "unsubscribed_count": 0, "bounced_count": 0, "id": "c7xsw", "name": "TestCampaign", "created_at": "Fri, 28 Mar 2014 14:27:26 GMT", "delivered_count": 0, "complained_count": 0, "dropped_count": 0}}

while a call to create a mailgin list responds with application/json:

~ → curl -i -s --user 'api:key-...' --data 'address=devtest@sandbox67449.mailgun.org' -X POST 'https://api.mailgun.net/v2/lists'
HTTP/1.1 200 OK
Server: nginx/1.4.1
Date: Fri, 28 Mar 2014 14:32:08 GMT
Content-Type: application/json
Content-Length: 263
Connection: keep-alive
Content-Disposition: inline
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 600
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type, x-requested-with

{
  "list": {
    "access_level": "readonly",
    "address": "devtest@sandbox67449.mailgun.org",
    "created_at": "Fri, 28 Mar 2014 14:32:08 -0000",
    "description": "",
    "members_count": 0,
    "name": ""
  },
  "message": "Mailing list has been created"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment