lukasoppermann / design-tokens

🎨 Figma plugin to export design tokens to json in an amazon style dictionary compatible format.
https://www.figma.com/community/plugin/888356646278934516/Design-Tokens
MIT License
964 stars 134 forks source link

Feature Request: URL upload - Content-Type Update #181

Closed dgmartin closed 2 years ago

dgmartin commented 2 years ago

The Problem: Currently when selecting the option to upload to a URL you have three options: (Github) token, Basic auth, and Bearer token auth. When trying to make a call using a Gitlab pipeline trigger URL the server can be reached only using the Github Authorization or Basic Authorization configurations however in both cases the payload is rejected due to fact that the "Content-Type" header is set as "text/plain;charset=UTF-8." After testing this same request/payload using postman I found that changing this header value to "application/json" would let the request through and a user could retrieve the payload under the "TRIGGER_PAYLOAD" environment variable in the CI/CD Pipeline run.

The Solution: The ask here is to include a settings change for the "Content-Type" header to allow the end user to update this to "application/json." This would be similar to the way the "Accept" header can currently be overridden. Alternatively because the call is already passing json perhaps it makes more sense to make "application/json" the default value anyway.

More information on the use with Gitlab webhook can be found here. Note the webhook URL format is slightly different than the URL used for form submission

lukasoppermann commented 2 years ago

Hey @dgmartin, thank you for raising this. Let me rephrase this to make sure I understand it correctly.:

You need a new settings option called "Content Type" that can be set to "text/plain" or "application/json" correct?

I think we are currently are not setting the content type at all.

If this is correct, would you be able to send a PR for this?