Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

feat: add slice for routing POST requests #51

Merged
merged 4 commits into from
Dec 8, 2021
Merged

feat: add slice for routing POST requests #51

merged 4 commits into from
Dec 8, 2021

Conversation

genryxy
Copy link
Contributor

@genryxy genryxy commented Nov 29, 2021

Part of artipie/artipie#321
Added slice ApiRepoPostRtSlice for routing post requests by parsing body content. This class will be used in artipie module. Test will be added in next PR

@genryxy genryxy requested review from a team and olenagerasimova and removed request for a team November 29, 2021 11:21
Copy link
Member

@olenagerasimova olenagerasimova left a comment

Choose a reason for hiding this comment

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

@genryxy thanks, looks good to me

@genryxy
Copy link
Contributor Author

genryxy commented Nov 29, 2021

@g4s8 could you please check/merge

@genryxy genryxy requested a review from g4s8 November 29, 2021 13:38
@genryxy
Copy link
Contributor Author

genryxy commented Nov 30, 2021

@g4s8 could you please take a look

Copy link
Member

@g4s8 g4s8 left a comment

Choose a reason for hiding this comment

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

@genryxy please check my comments

@@ -35,13 +35,15 @@ repo:
- download
{{/if}}</textarea>
<input name="repo" type="hidden" value="{{name}}"/>
<input name="method" type="hidden" value="update"/>
Copy link
Member

Choose a reason for hiding this comment

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

Term method is confusing here: method in HTTP protocol is a part of request line and it also can have value delete, so I'd change it to action or similar

<input id="config-submit" type="submit" value="Update"/>
</fieldset>
</form>

<form id="repo-delete-form" action="/api/repos/{{user}}?method=delete" method="POST">
<fieldset>
<input name="repo" type="hidden" value="{{name}}"/>
<input name="method" type="hidden" value="delete"/>
Copy link
Member

Choose a reason for hiding this comment

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

Same here

* @checkstyle StringLiteralsConcatenationCheck (10 lines)
*/
private static String value(final String payload, final String name) {
final int start = payload.indexOf(String.format("%s=", name)) + name.length() + 1;
Copy link
Member

Choose a reason for hiding this comment

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

You can use some library to parse URI queries here, and I'm suggesting to URL-encode parameters, since payload may contain & chars

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do I understand correct that both parameters name and parameters may contain &? Or in this case it would be parsed as an argument with empty value?

* Type of method of request.
* @since 0.5
*/
private enum Method {
Copy link
Member

Choose a reason for hiding this comment

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

And this class name could be renamed too

@genryxy
Copy link
Contributor Author

genryxy commented Dec 7, 2021

@g4s8 thanks, corrected

@genryxy genryxy requested a review from g4s8 December 7, 2021 21:56
Copy link
Member

@g4s8 g4s8 left a comment

Choose a reason for hiding this comment

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

@genryxy thanks

@g4s8 g4s8 merged commit 49dc0d8 into artipie:master Dec 8, 2021
g4s8 added a commit that referenced this pull request Dec 22, 2021
* Add absent repos

* cicd(release): added release config for #38

* Fixed parameters and storage settings format in `ApiRepoUpdateSlice`

Closes #39 - fixed 2 problems in ApiRepoUpdateSlice:
 1) parameters separator was expected to be ; instead of &
 2) storage settings were always expected to be yaml, but there also can be string for default value

PR: #40

* Repo config should be url decoded

Closes #39 - Body with repo configs should be url-decoded.

PR: #41

* Improved updating storage settings functionality (#43)

Closes #42 - simplified and fixed updating storage scenario in ApiRepoUpdateSlice.

On dashboard we always work with whole yaml repo settings, so there is no need to update section by section, we can simply rewrite the whole file after checking that required fields (type and storage) are present in the new version.

* fix: added repository configuration descriptions

Added description for several repositories.

Issue: artipie/artipie#317
PR: #44

* fix: handle errors in `ApiRepoUpdateSlice` (#45)

Handle errors in `ApiRepoUpdateSlice` (#45)

Closes: artipie/artipie#320

* feat(conda): added conda repository to dashboard (#46)

Added anaconda repository option to dashboard and configuration description.

Ticket: artipie/artipie#317

* doc: verbose link name

Clarified API reference link name.

Closes: #47

* fix: add rq line to get users in `FromRqLine` (#48)

Part of artipie/artipie#965
Added rq line to get users in FromRqLine, corresponding test and updated http and asto.

* feat: added slice for repo delete (#49)

Add slice to delete a repo. Added disabled test for this slice as it is necessary to implement delete operation in FakeConfigFile class.

Ticket: artipie/artipie#321

* feat: add slice for routing `POST` requests (#51)

Added slice ApiRepoPostRtSlice for routing post requests by parsing body content. This class will be used in artipie module. Test will be added in next PR.

Ticket: artipie/artipie#321

* deps: bumped ppom and other deps (#53)

 * Bumped ppom from 0.5.1 to 1.1.0
 * Bumped asto from v1.9.0 to v1.10.0
 * Bumped http-client from 0.3.2 to 0.3.6
 * Bumped vert-server from 0.4 to 0.5

* refactor: extract class for body parsing (#52)

Extract class for parsing body content for receiving some content.

Close: #50

* test: enable test for delete and add for postRt (#55)

Enable and a bit extend test for ApiRepoDeleteSlice and add test for ApiRepoPostRtSlice.

Ref: artipie/artipie#321

* refactor: use storages instead of settings storage

Co-authored-by: Kirill <[email protected]>
Co-authored-by: Alena <[email protected]>
g4s8 added a commit that referenced this pull request Dec 27, 2021
* Add absent repos

* cicd(release): added release config for #38

* Fixed parameters and storage settings format in `ApiRepoUpdateSlice`

Closes #39 - fixed 2 problems in ApiRepoUpdateSlice:
 1) parameters separator was expected to be ; instead of &
 2) storage settings were always expected to be yaml, but there also can be string for default value

PR: #40

* Repo config should be url decoded

Closes #39 - Body with repo configs should be url-decoded.

PR: #41

* Improved updating storage settings functionality (#43)

Closes #42 - simplified and fixed updating storage scenario in ApiRepoUpdateSlice.

On dashboard we always work with whole yaml repo settings, so there is no need to update section by section, we can simply rewrite the whole file after checking that required fields (type and storage) are present in the new version.

* fix: added repository configuration descriptions

Added description for several repositories.

Issue: artipie/artipie#317
PR: #44

* fix: handle errors in `ApiRepoUpdateSlice` (#45)

Handle errors in `ApiRepoUpdateSlice` (#45)

Closes: artipie/artipie#320

* feat(conda): added conda repository to dashboard (#46)

Added anaconda repository option to dashboard and configuration description.

Ticket: artipie/artipie#317

* doc: verbose link name

Clarified API reference link name.

Closes: #47

* fix: add rq line to get users in `FromRqLine` (#48)

Part of artipie/artipie#965
Added rq line to get users in FromRqLine, corresponding test and updated http and asto.

* feat: added slice for repo delete (#49)

Add slice to delete a repo. Added disabled test for this slice as it is necessary to implement delete operation in FakeConfigFile class.

Ticket: artipie/artipie#321

* feat: add slice for routing `POST` requests (#51)

Added slice ApiRepoPostRtSlice for routing post requests by parsing body content. This class will be used in artipie module. Test will be added in next PR.

Ticket: artipie/artipie#321

* deps: bumped ppom and other deps (#53)

 * Bumped ppom from 0.5.1 to 1.1.0
 * Bumped asto from v1.9.0 to v1.10.0
 * Bumped http-client from 0.3.2 to 0.3.6
 * Bumped vert-server from 0.4 to 0.5

* refactor: extract class for body parsing (#52)

Extract class for parsing body content for receiving some content.

Close: #50

* test: enable test for delete and add for postRt (#55)

Enable and a bit extend test for ApiRepoDeleteSlice and add test for ApiRepoPostRtSlice.

Ref: artipie/artipie#321

* fix: delete from items from substorage

Co-authored-by: Kirill <[email protected]>
Co-authored-by: Alena <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants