Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add base64encode and base64decode into builtin functions #4

Merged
merged 2 commits into from
Jun 13, 2018

Conversation

jiejie-dev
Copy link
Contributor

Add # .

Changes proposed in this pull request:

  • Add base64encode and base64decode into builtin functions

When one api required basic auth:

// This is a frank test case file
// -- https://github.com/txthinking/frank

url = "http://localhost:5000/v2.0"

POST /zone/login
header["Accept"] = "application/json"
header["Content-Type"] = "application/json"
header["Authorization"] = "Basic " + base64encode("jeremaihloo1024@gmail.com:admin")
json = {
    "email":"jeremaihloo1024@gmail.com",
	"password":"admin"
}

Response
must(status==200)

@txthinking Is there another way to do this instead of adding builtin functions ?

Sorry for my chinglish and bad PR comments.

fmt.Println("ERROR", err)
return otto.Value{}
}
sb, err := base64.StdEncoding.DecodeString(s)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you missed an error checking

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have copied the error checking bellow.

@txthinking

Copy link
Owner

@txthinking txthinking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@txthinking txthinking merged commit 83ba3d4 into txthinking:develop Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants