Wrox Programmer Forums
BOOK: Patterns, Principles and Practices of Domain-Driven Design
This is the forum to discuss the Wrox book Patterns, Principles and Practices of Domain-Driven Design by Scott Millett; ISBN: 978-1-118-71470-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Patterns, Principles and Practices of Domain-Driven Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 12th, 2015, 07:09 PM
Registered User
Join Date: Jul 2015
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 13 - HAL Browser Update

I typed and ran the REST API example in chapter 13 using the current version of the HAL browser. It seems that this version sets the useCredentials property to true when making its AJAX requests. So, to make the example work, I had to configure CORS on the Accounts API to support credentials, and then set the allowed origins to be the URL of the EntryPoint API (because the CORS specification won't allow a wildcard in this scenario).

To make the example work with the latest HAL browser, go to the following line of code in the Register method of WebApiConfig.cs in the Accounts API project:

var cors = new EnableCorsAttribute("*", "*", "*");

and replace this line with the following two lines of code:

var cors = new EnableCorsAttribute("http://localhost:4100", "*", "*");
cors.SupportsCredentials = true;

This should produce the same results as the code sample in the book.

Thank you very much,

Old August 13th, 2015, 02:58 AM
Wrox Author
Join Date: May 2015
Posts: 59
Thanks: 1
Thanked 5 Times in 5 Posts

Hi Andy,

Really appreciate that you persevered with the HAL browser and shared your findings for the benefit of other people. I will tweet your post and ask Wrox to add it to the errata amendments.

Thank you very much
Old December 5th, 2015, 08:39 AM
Registered User
Join Date: Dec 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Accept Header

I'm using WebApi.Hal 2.6.0 and I had to add the Accept header in order for Hal browser to work.

In particular I added the following snippet to the Custom Request Headers field in the Hal Browser:

Accept: application/hal+json.

The response is not the same using the default applicaton/json format, and Hal Browser was throwing a javascript error.

It took me a while to find out the solution. Just sharing in case somebody else is facing the same issue.

Old February 11th, 2016, 05:13 PM
Wrox Author
Join Date: May 2015
Posts: 59
Thanks: 1
Thanked 5 Times in 5 Posts

Thanks for taking the time to post that update. This highlights one of the difficult problems about writing a book - paper can't keep up with technology.

Thanks again and hope you enjoyed the book.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 13: Detailview doesn't Update. oceanjams BOOK: Beginning ASP.NET 4.5 : in C# and VB 2 March 20th, 2015 11:10 AM
Chapter 13 thepianoguy BOOK: Professional iPhone and iPad Application Development 3 April 6th, 2011 09:42 AM
Rolling headers (13 months) how to update records Axxess Access VBA 0 May 22nd, 2008 06:24 AM
Hey Hal ! augustine SQL Server 2000 1 August 2nd, 2004 08:57 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.