tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Hangman game in JS lesson 5 documentation is not clear

Open matyikriszta opened this issue 9 years ago • 2 comments

@samsworldofno could you add some details about this issue?

matyikriszta avatar Apr 13 '16 18:04 matyikriszta

Sure thing @matyikriszta!

The documentation is not clear on the hangman API for requests that need a body. Although the request body is illustrated in the format { token: game token, letter: guess }, the application actually takes data in x-www-form-urlencoded, so the request should be something like:

  curl -XPUT https://hangman/hangman -D "token=XXXXXX&letter=y"

The tutorial definitely doesn't make this clear enough, but moreover I suggest that we should change the application so that it accepts JSON. This would be more inkeeping with the previous tutorial and way more common than form parameters in the world of APIs. This pull request illustrates how this might be done on the PUT request only. If others agree that this approach is good, I'm happy to complete the change.

samsworldofno avatar Apr 13 '16 18:04 samsworldofno

@samsworldofno I agree with you, happy for you to implement that change

matyikriszta avatar Apr 13 '16 19:04 matyikriszta