Tuesday, 15 August 2017

Capturing raw data in Web Api controller

I needed to capture raw POSTed data in a Web API controller endpoint. This is how it's done:
using (var contentStream = await this.Request.Content.ReadAsStreamAsync())
                contentStream.Seek(0, SeekOrigin.Begin);
                using (var sr = new StreamReader(contentStream))
                    string rawData = sr.ReadToEnd();

Monday, 14 August 2017

Sourcetree error "remote: empty password" after updating to new version

I updated my Sourcetree installation today and could no longer push to my Bitbucket repositories. Seems like I'm not the only one who gets the error

remote: empty password
A workaround until they fix this bug is this - copy the first line of the Sourcetree error message (which is the Git command that failed), open a new terminal window (Shift-Alt-T on Windows), and paste it in, hit return. This will run the Push command and ask you for your password.

UPDATE: Here's a permanent fix - delete the file named passwd located in AppData\Local\Atlassian\SourceTree