Closed VJayMeyer closed 5 years ago
Linking to #19 - Sadly I don't have a good answer for this today. I know the problem I had when I was messing with the code in the early days, that I could not process a non '200' response. But, I know the desire is to have additional values. Let me see if I can get some time to spend on this to return other than 200 back.
Thanks Justin. That will be cool.
Are you using the System.Web.Http namespace in your project? You can return these as part of the HttpResponseMessage by defining System.Net.HttpStatusCode?
Very cool project. I had some spare time today and came across it. I linked it to Azure Storage Tables as the back end. Lots of fun ☺
That's awesome! It's always exciting to hear people are using or trying your code. I found my issue! I was not using 'StatusDescription' at all and trying to overload the return with text.
To answer your question; I am using the HttpListener class.
Example result from test endpoint:
PS C:\WINDOWS\system32> $error[0].exception.response
IsMutuallyAuthenticated : False
Cookies : {ARRAffinity=77c477e3e649643e5771873e1a13179fb00983bc73c71e196bf25967fd453df9}
Headers : {X-AspNetMvc-Version, Access-Control-Allow-Origin, Content-Length, Cache-Control...}
SupportsHeaders : True
ContentLength : 0
ContentEncoding :
ContentType :
CharacterSet :
Server : Microsoft-IIS/10.0
LastModified : 1/16/2019 4:44:33 PM
StatusCode : NotFound
StatusDescription : Not Found
ProtocolVersion : 1.1
ResponseUri : http://httpstat.us/404
Method : GET
IsFromCache : False
New return from RestPS:
PS C:\WINDOWS\system32> $error[0].exception.response
IsMutuallyAuthenticated : False
Cookies : {}
Headers : {Content-Length, Content-Type, Date, Server}
SupportsHeaders : True
ContentLength : 0
ContentEncoding :
ContentType : application/json
CharacterSet :
Server : Microsoft-HTTPAPI/2.0
LastModified : 1/16/2019 4:44:09 PM
StatusCode : NotFound
StatusDescription : Not Found
ProtocolVersion : 1.1
ResponseUri : http://localhost:8081/endpoints/routes
Method : GET
IsFromCache : False
Thanks for submitting the issue, and having me track this down! I'm glad I finally tackled it!
Oh, the new module is available in the PowerShellGallery! Let me know if you experience any problems with it.
Is there a reason why the HTTP code is always 200 and one has to use the message response to see the actual code. Say 404 or 400? Thank you.