Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

AsString extension no longer works #2698

Closed
5 of 8 tasks
jchannon opened this issue Feb 2, 2017 · 9 comments
Closed
5 of 8 tasks

AsString extension no longer works #2698

jchannon opened this issue Feb 2, 2017 · 9 comments

Comments

@jchannon
Copy link
Member

jchannon commented Feb 2, 2017

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of Nancy
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

Description

We recently moved the Request.Body to a Stream away from a RequestStream. We have an extension that allows you to get a request body as string however its an extension method off of RequestStream.

Steps to Reproduce

To get this to work you have to do ((RequestStream)this.Body)>AsString() which is nasty.

This needs fixing

public static string AsString(this RequestStream stream, Encoding encoding = null)

I think this test needs ammending https://github.com/NancyFx/Nancy/blob/be4f8d42076e4e568a3742715437868e6c7d05af/test/Nancy.Tests/Unit/Extensions/RequestStreamExtensionsFixture.cs

System Configuration

  • Nancy version: 2.0-clinteastwood
  • Nancy host
    • ASP.NET
    • OWIN
    • Self-Hosted
    • Other: Kestrel
  • Other Nancy packages and versions:
  • Environment (Operating system, version and so on): OSX but will apply to all
  • .NET Framework version:
  • Additional information:
@jchannon jchannon added this to the 2.0-dangermouse milestone Feb 2, 2017
@thecodejunkie
Copy link
Member

So it should be an extension method on Stream instead, is that way you are saying?

@jchannon
Copy link
Member Author

jchannon commented Feb 2, 2017 via email

@thecodejunkie
Copy link
Member

Wouldn't it be quicker to send a PR than to write an issue and link stuff? 🤣

@jchannon
Copy link
Member Author

jchannon commented Feb 2, 2017 via email

@josephwoodward
Copy link

Wouldn't it be quicker to send a PR than to write an issue and link stuff?

Not to mention it's always nice having PRs like this up for grabs for first timers :)

@jchannon
Copy link
Member Author

jchannon commented Feb 2, 2017

Make it so...

@ghuntley
Copy link

ghuntley commented Feb 2, 2017

Wouldn't it be quicker to send a PR than to write an issue and link stuff?

Yes, it is faster to fix it yourself, but that removes opportunities for newbies to open-source or even seasoned vets (who are looking for suggestions of value) to get involved with the project. Check out @yourfirstpr - https://yourfirstpr.github.io/ for more information. Without new blood; projects atrophy.

@pawelsawicz
Copy link
Contributor

I can do that

@pawelsawicz
Copy link
Contributor

Apologies there was a typo in PR title, too long on the front of PC :( it has been renamed

@jchannon jchannon closed this as completed Feb 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants