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

Couldn't send url encoded form params #65

Open
sprakasam opened this issue Jan 19, 2016 · 2 comments
Open

Couldn't send url encoded form params #65

sprakasam opened this issue Jan 19, 2016 · 2 comments

Comments

@sprakasam
Copy link

The server receives the url encoded form params as single entry with param "key" populated with whole thing mentioned for "test.request.body" in raml file and param "value" as empty string. Like,

key = {"id": "...", "imageType": "...", "imageBase64Encoded": "..."}, value = ""

Note: I don't have any problem with RAML file.

Hookup file:
hooks.before('POST /v1/foo -> 200', function (test, done) {

test.request.headers = {
    'Authorization': 'Bearer ' + '77aacdc2-49ea-32cd-8772-e90f3f3e1325',
    'Content-Type': 'application/x-www-form-urlencoded'
};
test.request.body = {
    id: '...',
    imageType: 'image/png',
    imageBase64Encoded: '....'
}

}

@plroebuck
Copy link
Collaborator

Think the problem is with your test.request.body -- for application/x-www-form-urlencoded, it should be in the format MyVariableOne=ValueOne&MyVariableTwo=ValueTwo, using percent encoding [wikipedia, blog]. As an aside, usually sending binary files (PNG images) would be done more efficiently using multipart/form-data encoding instead.

@plroebuck
Copy link
Collaborator

Hookup file... hilarious! Interweb dating site?

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

No branches or pull requests

3 participants