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

Changed exception when sending msg to queue without proper url #493

Merged
merged 4 commits into from
Jun 21, 2021

Conversation

rojekp
Copy link

@rojekp rojekp commented Jun 1, 2021

No description provided.

def requiredUrlParam(n: String): Directive1[String] = {
p.get(n) match {
case Some(v) => provide(v)
case None => reject(WrongURLFormatRejection(n))
Copy link
Member

Choose a reason for hiding this comment

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

hm well if the parameter is absent, then the format isn't wrong, it's missing, no? :)

Copy link
Author

Choose a reason for hiding this comment

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

Yes, changed back to MissingQueryParamRejection :)

Copy link
Member

Choose a reason for hiding this comment

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

It's still the same?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, resulting exception is still the same.

Copy link
Member

Choose a reason for hiding this comment

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

I mean, the method requiredUrlParam gives a WrongURLFormatRejection which is not very logical

Copy link
Author

Choose a reason for hiding this comment

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

Modified solution, added new directive.

@rojekp rojekp marked this pull request as ready for review June 2, 2021 13:15
private def checkOnlyQueueNameInUri(): Directive1[String] = {
extractUri.flatMap {
uri => {
val onlyQueueNameInUriPath = Option(uri.path.toString().tail)
Copy link
Member

Choose a reason for hiding this comment

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

doesn't this always return Some(the uri without the first character)?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for advice, now I'm checking if there is only one segment in uri.

@adamw adamw merged commit cbee629 into master Jun 21, 2021
@mergify mergify bot deleted the fix-exception-value branch June 21, 2021 17:40
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

Successfully merging this pull request may close these issues.

when using queue name to send messages get Invalid request: MissingQueryParamRejection(QueueName),
2 participants