knuckleswtf / scribe

Generate API documentation for humans from your Laravel codebase.✍
https://scribe.knuckles.wtf/laravel/
MIT License
1.58k stars 280 forks source link

Theme elements with multipart/form-data #831

Open onovaes opened 3 months ago

onovaes commented 3 months ago

Scribe version

4.34.0

Your question

It seems like I've encountered an issue while testing the "elements" theme, where form fields are not being submitted when the form is encoded as multipart/form-data. This works seamlessly in the default theme, but not in the "elements" theme.

Below are the CURL commands generated for each request. It appears that in the "elements" theme, the --data-binary flag is absent, and instead, an empty data-raw is present.

I'm reaching out to the developers to confirm whether this is indeed an error.

laravel with default theme (Working)

curl 'http://localhost:8888/api/posts' -X POST \ -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0' \ -H 'Accept: application/json' \ -H 'Accept-Language: en-US,en;q=0.5' \ -H 'Accept-Encoding: gzip, deflate, br' \ -H 'Referer: http://localhost:8888/' \ -H 'Authorization: Bearer b99f5c6c-cc30-45e6-81b0-f0f9cd0846b6|Q6aZfcINiCKB4AjjVA6OkX4BT8QPanLCXcIgwEU0d2ab1cd2' \ -H 'Content-Type: multipart/form-data; boundary=---------------------------20342533954181054103118050126' \ -H 'Origin: http://localhost:8888' \ -H 'Connection: keep-alive' \ -H 'Sec-Fetch-Dest: empty' \ -H 'Sec-Fetch-Mode: cors' \ -H 'Sec-Fetch-Site: same-origin' --data-binary $'-----------------------------20342533954181054103118050126\r\nContent-Disposition: form-data; name="title"\r\n\r\nMy first post\r\n-----------------------------20342533954181054103118050126\r\nContent-Disposition: form-data; name="body"\r\n\r\nThis is the body of my first post2\r\n-----------------------------20342533954181054103118050126\r\nContent-Disposition: form-data; name="slug"\r\n\r\nm1212y-first-post\r\n-----------------------------20342533954181054103118050126\r\nContent-Disposition: form-data; name="excerpt"\r\n\r\nThis is the excerpt of my first post\r\n-----------------------------20342533954181054103118050126\r\nContent-Disposition: form-data; name="visibility"\r\n\r\npublish\r\n-----------------------------20342533954181054103118050126\r\nContent-Disposition: form-data; name="source"\r\n\r\nhttps://cnn.com\r\n-----------------------------20342533954181054103118050126\r\nContent-Disposition: form-data; name="published_at"\r\n\r\n2024-01-08 10:12:03\r\n-----------------------------20342533954181054103118050126--\r\n';

Laravel with elemets theme (Not working)

curl 'http://localhost:8888/api/posts' \ -X POST -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0' \ -H 'Accept: application/json' \ -H 'Accept-Language: en-US,en;q=0.5' \ -H 'Accept-Encoding: gzip, deflate, br' \ -H 'Referer: http://localhost:8888/' \ -H 'Authorization: Bearer b99f5c6c-cc30-45e6-81b0-f0f9cd0846b6|Q6aZfcINiCKB4AjjVA6OkX4BT8QPanLCXcIgwEU0d2ab1cd2' \ -H 'Content-Type: multipart/form-data' \ -H 'Origin: http://localhost:8888' \ -H 'Connection: keep-alive' \ -H 'Sec-Fetch-Dest: empty' \ -H 'Sec-Fetch-Mode: cors' \ -H 'Sec-Fetch-Site: same-origin' --data-raw '';

Docs