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

Postman collection body mode "formdata" #730

Closed
1 task done
thewhaleiam opened this issue Sep 14, 2023 · 5 comments
Closed
1 task done

Postman collection body mode "formdata" #730

thewhaleiam opened this issue Sep 14, 2023 · 5 comments
Labels
question Further information is requested

Comments

@thewhaleiam
Copy link

Scribe version

4.22

Your question

With regards to the collection file generated for postman, I can see that the body elements are generated with the mode of "raw", is there a way to configure this so that it uses "formdata" and generates json accordingly?

Docs

@thewhaleiam thewhaleiam added question Further information is requested triage labels Sep 14, 2023
@shalvah
Copy link
Contributor

shalvah commented Sep 14, 2023

You want form-data type, but JSON body? Isn't that a contradiction?

@shalvah shalvah removed the triage label Sep 14, 2023
@thewhaleiam
Copy link
Author

So, no I meant that that on the import file I would like to have body json to be

"body": { "mode": "formdata", "formdata": [ { "key": "email", "value": "<string>", "type": "text" }, { "key": "password", "value": "<string>", "type": "text" } ] },

rather than
"body": { "mode": "raw", "raw": "{\"email\":\"user@email.com\",\"password\":\"password12\"}" },

I was wondering if there was a setting that would allow this to happen?

@shalvah
Copy link
Contributor

shalvah commented Sep 18, 2023

See

$inputMode = match ($contentType) {
'multipart/form-data' => 'formdata',
'application/x-www-form-urlencoded' => 'urlencoded',
default => 'raw',
};
. It sets these based on your content-type header.

@shalvah shalvah closed this as completed Sep 18, 2023
@thewhaleiam
Copy link
Author

When I add the attributes it prevents the form being posted as it now fails validation?

#[Header("Content-Type", "multipart/form-data")]

@shalvah
Copy link
Contributor

shalvah commented Sep 20, 2023

Huh?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants