Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 8 Online Section http linebreaks not working #7

Closed
Pip1987 opened this issue Feb 16, 2024 · 2 comments
Closed

Chapter 8 Online Section http linebreaks not working #7

Pip1987 opened this issue Feb 16, 2024 · 2 comments

Comments

@Pip1987
Copy link

Pip1987 commented Feb 16, 2024

*** This is a Visual Studio issue see comment below.***
I'm working through chapter 8's online section for odata when I try the request

###
GET {{base_address}}categories/
  ?$select=CategoryId,CategoryName

it returns

{
  "@odata.context": "https://localhost:5084/catalog/$metadata#Categories",
  "value": [
    {
      "CategoryId": 1,
      "CategoryName": "Beverages",
      "Description": "Soft drinks, coffees, teas, beers, and ales",
       .......

and I have an error stating '?$select=CategoryId,CategoryName' is not a valid http header. Expecting a valid http header or a blank line to separate the header section from the request body.
when I run the request as a single line GET {{base_address}}categories/?$select=CategoryId,CategoryName the output is correct.

{
  "@odata.context": "https://localhost:5084/catalog/$metadata#Categories(CategoryId,CategoryName)",
  "value": [
    {
      "CategoryId": 1,
      "CategoryName": "Beverages"
    },
    {
      "CategoryId": 2,
      "CategoryName": "Condiments"
    },
    ...

I've tried both with and without indent on the the ?$select line.

P.S.
And I know I've done a few issues, but honestly this book and the previous have been really helpful on learning new things and how to do other things better with c#. I've been really enjoying the books.

@Pip1987
Copy link
Author

Pip1987 commented Feb 16, 2024

So looking over http file documentation on the Microsoft website for un related issue I found this https://learn.microsoft.com/en-us/aspnet/core/test/http-files?view=aspnetcore-8.0#unsupported-syntax stating that multi line requests don't work. Apparently these will work in Visual Studio code though.

@Pip1987 Pip1987 closed this as completed Feb 16, 2024
@markjprice
Copy link
Owner

Thanks! I have added an errata item for this:
https://github.com/markjprice/apps-services-net8/blob/main/docs/errata/errata.md#page-366---exercise-84--exposing-data-via-the-web-using-odata-services

p.s. I'm happy to hear that you're enjoying the books. I really appreciate you taking the time to raise these issues that help everyone. Keep them coming!

p.p.s. I'm busy writing the third book and have deadlines every Monday for new chapters so I don't have as much time as usual to investigate issues but quick ones like these I try to get to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants