Skip to content

Add handlebars helper to convert to base64#332

Merged
255kb merged 1 commit intomockoon:feature/base64-helperfrom
maillouxc:maillouxc-base64
Aug 20, 2020
Merged

Add handlebars helper to convert to base64#332
255kb merged 1 commit intomockoon:feature/base64-helperfrom
maillouxc:maillouxc-base64

Conversation

@maillouxc
Copy link
Contributor

** Summary **

Adds a base64 handlebars helper function to convert the input to a base64 string

Also adds a newline handlebars helper due to the difficulty of doing complex handlebars strings with newlines inside.

Usage sample

{
"file": "{{#base64}} FirstName,LastName,CountryCode {{newLine}} {{# repeat 10 comma=false}}{{ faker 'name.firstName' }},{{ faker 'name.lastName' }},{{ faker 'address.countryCode' }} {{newLine}} {{/ repeat}}{{/base64}}"
}

Related Issue

Issue: #331

Motivation and Context

We wanted to be able to return a dynamically generated base64 encoded CSV file

How Has This Been Tested?

Tested using the sample input above.

Closes #331

Usage sample:

{
  "file": "{{#base64}} FirstName,LastName,CountryCode {{newLine}} {{# repeat  10 comma=false}}{{ faker 'name.firstName' }},{{ faker 'name.lastName' }},{{ faker 'address.countryCode' }} {{newLine}} {{/ repeat}}{{/base64}}"
}
@maillouxc maillouxc requested a review from 255kb as a code owner August 20, 2020 15:33
@255kb 255kb added this to the next milestone Aug 20, 2020
@255kb 255kb changed the base branch from master to feature/base64-helper August 20, 2020 19:25
@255kb 255kb merged commit 555ce9b into mockoon:feature/base64-helper Aug 20, 2020
@255kb
Copy link
Member

255kb commented Aug 20, 2020

Thank you for your contribution.
+1 for the newline helper. It's a great addition!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Handlebars helper to convert to base64

2 participants