-
Notifications
You must be signed in to change notification settings - Fork 165
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
Added ${aspnet-request-form} #313
Added ${aspnet-request-form} #313
Conversation
… the request form collection.
…sp.net core and .net
…in the AspNetCore.Tests project.
Codecov Report
@@ Coverage Diff @@
## master #313 +/- ##
=====================================
+ Coverage 61% 62% +1%
=====================================
Files 31 32 +1
Lines 435 454 +19
Branches 92 97 +5
=====================================
+ Hits 266 282 +16
- Misses 134 135 +1
- Partials 35 37 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Looks very good, added some notes for the final touches.
/// Gets or sets the form keys to exclude in the output. If omitted, none are excluded. | ||
/// </summary> | ||
/// <docgen category='Rendering Options' order='10' /> | ||
public string Exclude { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idem, Set please :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not sure what you are asking for on this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ordering of the comments are changed. I meant: the same as #313 (comment)
{ | ||
formDataList.Add($"{item.Key}={item.Value}"); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if we could reduce the code duplication here, (foreach / if check)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed code duplication by changing to a foreach that works for both AspNetCore and .net framework. https://github.com/DrewBrasher/NLog.Web/commit/8b7999a93bc75e3834e21d5cd999824bea184976
/// Gets or sets the form keys to include in the output. If omitted, all are included. | ||
/// </summary> | ||
/// <docgen category='Rendering Options' order='10' /> | ||
public string Include { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use list/set here :)
(Since NLog 4.4 - https://nlog-project.org/2016/12/14/nlog-4-4-is-live.html)
I prefer a ISet<String>
(for .NET 3.5 is should be HashSet<String>
)
You could make it default case insensitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this?
#if ASP_NET_CORE
public ISet<string> Include { get; set; }
#else
public HashSet<string> Include { get; set; }
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes indeed 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed Include and Exclude to case insensitive HashSets.
https://github.com/DrewBrasher/NLog.Web/commit/8eb037049c212c70d2b85668883788d0565d5bb4
… AspNetCore and .net framework .
nice! One question, if an item is in include and exclude, which one has precedence? It seems to be exclude, but i'm not sure if that's common. (we need to check that) |
You are correct that exclude currently takes precedence. I've looked around and see examples of other software doing it both ways. Either way is fine with me and I will add a unit test to cover whichever way is decided. Here are some examples: Exclude Takes precedence: https://stackoverflow.com/questions/11959211/maven-surefire-plugin-include-exclude-precedence Other examples: |
@304NotModified which one would you rather have take precedence? |
HI, Thanks for looking at this! I think docs are the most important and as it is inconsistent, I don't prefer really one above the other. So we could keep it like this. |
will try to finish this PR in the beginning of next week |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! looks good!
One small improvement is possible, see note
/// Gets or sets the separator to use between each key/value pair. If omitted, <see cref="Environment.NewLine"/> is used. | ||
/// </summary> | ||
/// <docgen category='Rendering Options' order='10' /> | ||
public string Separator { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be a Layout. What do you think? We can use then ${newline}
etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be better. I didn't realize I could do that. Do you think I should still have newline as the default separator or would something else be better as the default? The main reason I had newline as the default was because I didn't know I could set it up to take a layout. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think newline is fine, but in other renderers we use space. Not sure what would be the best in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change it to a space to keep it consistent with the others. With it being a Layout instead of a string people can easily make it a newline if they want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed the base class AspNetLayoutMultiValueRendererBase
and I'm wondering if I should change this to extend that class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doubting about that. It isn't a bad idea, but unfortunately no Layouts there. Both are fine to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS I like to release this soon :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed the layout thing (see #317), so please subclass from
AspNetLayoutMultiValueRendererBase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I will do that now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
/// Gets or sets the separator to use between each key/value pair. If omitted, <see cref="Environment.NewLine"/> is used. | ||
/// </summary> | ||
/// <docgen category='Rendering Options' order='10' /> | ||
public string Separator { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed the layout thing (see #317), so please subclass from
AspNetLayoutMultiValueRendererBase
It won't let me view the details:
[image: image.png]
…On Sat, Sep 22, 2018 at 11:29 AM Julian Verdurmen ***@***.***> wrote:
PS could you see these results?
[image: image]
<https://user-images.githubusercontent.com/5808377/45919451-778e0200-be95-11e8-8477-1d69b3c45213.png>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#313 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AI194nR6DHVnqyY0FeNjaWEKjacGQ4TMks5udmV4gaJpZM4Wewq->
.
--
Thanks,
*Drew Brasher*
drewbrasher.com
|
Could you please try again? (added you as Collaborator) (I think you have an email, with a link you should click first) |
…rm-layout-renderer
I've changed AspNetRequestFormLayoutRenderer to be a subclass of AspNetLayoutMultiValueRendererBase and fixed the code check issue. |
🎉 great! |
Could you please help with docs on the wiki and https://github.com/NLog/NLog.github.io/blob/master/config/layout-renderers.json? I will prepare a release :) |
4.7 is live :) Thanks for the help! |
I added aspnet-request-form info to config/layout-renderers.json (https://github.com/DrewBrasher/NLog.github.io/commit/1aab227888d90d29644b6f42f9de76eaa4cd3f1d). What all has to be done to add to the documentation? |
We need a page on the wiki, (and it's linked by https://github.com/DrewBrasher/NLog.github.io/commit/1aab227888d90d29644b6f42f9de76eaa4cd3f1d#diff-ca51f403fc41bbc57d0471b9a7f64a3fR1730) - so we need https://github.com/NLog/NLog/wiki/AspNetRequest-Form-Layout-Renderer Thanks in advance! |
No description provided.