feat: remove the 10,000-character article body limit and make the New article body optional
This commit is contained in:
1 parent
5e05b606a7
commit
10ec74c8cf
28 files changed
+860
-397
No files matched your search
@@ -19,9 +19,9 @@ Feature: An authenticated user can edit an article's body
|
||||
DELETE /v1/article/{id}, PATCH /v1/article/{id}/publish and
|
||||
PATCH /v1/article/{id}/unpublish in api/router.go, so it also requires a valid
|
||||
jwt cookie
|
||||
And the request body is JSON {"body": "..."}, validated with
|
||||
validate:"required,max=10000" on the Body field, the same tag PostArticle.Body
|
||||
already carries
|
||||
And the request body is JSON {"body": "..."}; the Body field carries no validate tag
|
||||
(no max, not required), as PostArticle.Body, per
|
||||
features/article_body_unlimited.feature
|
||||
And a successful edit answers 200 with the JSON body of the updated article.Article,
|
||||
the same shape GetArticle, PostArticle, PublishArticle and UnpublishArticle
|
||||
already return; the article's title, is_online flag and images are unchanged
|
||||
@@ -30,9 +30,8 @@ Feature: An authenticated user can edit an article's body
|
||||
PublishArticle and UnpublishArticle
|
||||
And a body that is not valid JSON answers 400 with body apperr.BodyErrorMessage,
|
||||
the same as PostArticle
|
||||
And a body that fails its own required/max=10000 validation answers 400 with the
|
||||
raw validator error text, the same as PostArticle already does for its own
|
||||
fields; no new apperr message is introduced for this
|
||||
And no body value fails validation: an empty or absent body and a body of any length
|
||||
are accepted
|
||||
And an id absent from the article repository answers 404 with body
|
||||
apperr.ArticleNotFoundErrorMessage, backed by
|
||||
errors.Is(err, article.ErrArticleNotFound), the same as DeleteArticle,
|
||||
@@ -84,11 +83,12 @@ Feature: An authenticated user can edit an article's body
|
||||
Then the response status is 400
|
||||
And the response body is the text apperr.BodyErrorMessage
|
||||
|
||||
Scenario Outline: A body value that fails validation answers 400
|
||||
Scenario Outline: A body of any length, including empty, is accepted
|
||||
Given a valid jwt cookie for a user with id 1
|
||||
And the article repository contains an article with id 1
|
||||
When the client sends PATCH /v1/article/1 with that cookie and body <payload>
|
||||
Then the response status is 400
|
||||
Then the response status is 200
|
||||
And the stored body equals the sent body
|
||||
|
||||
Examples:
|
||||
| payload |
|
||||
|
||||
Reference in new issue
Block a user