This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class RunscopePassagewayHandler : DelegatingHandler { | |
| protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { | |
| if (request.RequestUri.Host.Contains("passageway.io")) { | |
| var uriWithoutPort = request.RequestUri.GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped); | |
| request.RequestUri = new Uri(uriWithoutPort); | |
| } | |
| return base.SendAsync(request, cancellationToken); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1) Remove all nuget packages with any relationship to the package having a problem | |
| 2) Ensure that no project still has a DLL reference to assemblies from those nuget packages | |
| 3) Remove all binding redirects related to these nuget packages | |
| 4) Add nuget packages, one at a time, in order of dependencies. (i.e. Don't let any nuget package automatically pull in another) | |
| 5) Add binding redirects for anything that still has a problem | |
| 6) Enjoy the build successful | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class TaskHelper | |
| { | |
| public static Task<T> RunWithCancel<T>(Func<CancellationToken,T> function, CancellationToken token) | |
| { | |
| return Task.Run(() => function(token),token); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class NullJsonHandler : DelegatingHandler | |
| { | |
| protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | |
| { | |
| var response = await base.SendAsync(request, cancellationToken); | |
| if (response.Content == null) | |
| { | |
| response.Content = new StringContent("{}"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static Func<IDictionary<string, object>, Task> CreateWebApiAppFunc(HttpConfiguration config) | |
| { | |
| var app = new HttpServer(config); | |
| var options = new HttpMessageHandlerOptions() | |
| { | |
| MessageHandler = app, | |
| BufferPolicySelector = new OwinBufferPolicySelector(), | |
| ExceptionLogger = new WebApiExceptionLogger(), | |
| ExceptionHandler = new WebApiExceptionHandler() | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static IDisposable CreateHttpListenerServer(Uri baseAddress, Func<IDictionary<string, object>, Task> appFunc) | |
| { | |
| var props = new Dictionary<string, object>(); | |
| var address = Address.Create(); | |
| address.Host = baseAddress.Host; | |
| address.Port = baseAddress.Port.ToString(); | |
| address.Scheme = baseAddress.Scheme; | |
| address.Path = baseAddress.AbsolutePath; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class JsonStringController : ApiController | |
| { | |
| public HttpResponseMessage Post([FromBody]string jsonBody) | |
| { | |
| var myobject = Newtonsoft.Json.JsonConvert.DeserializeObject<MyObject>(jsonBody) | |
| return new HttpResponseMessage(HttpStatusCode.Created); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Startup | |
| { | |
| public void Configuration(IAppBuilder app) | |
| { | |
| var webApiconfig = new HttpConfiguration(); | |
| webApiconfig.Routes.MapHttpRoute("test","Test",new {controller="Test"}); | |
| app.UseWebApi(webApiconfig); | |
| // Turn cross domain on | |
| var config = new HubConfiguration { EnableCrossDomain = true }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > | |
| <xsl:output method="xml" indent="yes" /> | |
| <xsl:template match="/ | @* | node()"> | |
| <xsl:copy> | |
| <xsl:apply-templates select="* | @* | node()" /> | |
| </xsl:copy> | |
| </xsl:template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class EmbeddedContent : HttpContent | |
| { | |
| private readonly Stream _Stream; | |
| public EmbeddedContent(Type locatorType, string filename, MediaTypeHeaderValue contentType = null) | |
| { | |
| Headers.ContentType = contentType ?? new MediaTypeHeaderValue("application/octet-stream"); |