News for hackers. Stuff that matters.
Re:Bypassing GitHub's OAuth Flow with a Head Request by wolco on Thursday November 07, 2019 @04:07PM (#21477257)
Could you explain that further.

Why would you avoid a serious statement in an else?

Would this be more acceptable? The negative on the if

  if !request.get?
Re:Bypassing GitHub's OAuth Flow with a Head Request by adverbly on Thursday November 07, 2019 @04:31PM (#21477521)
I assume the correct pattern for finite possible inputs would be something like

   if request.post? || request.put? || more...
     # do dangerous thing
   else
     # do safe thing
This of course ignores the smell which others have pointed out where with rails you would ideally have a totally different method get called in the first place for a GET vs a POST as you can have different actions for them in the controller.
Re:Bypassing GitHub's OAuth Flow with a Head Request by Existenceblinks on Friday November 08, 2019 @01:00PM (#21484910)
Because unknown gives anxiety.

Robot:

  if !request.get?
    do_nothing
  else
    kill_one_person
  end
What are possible states for NOT `!get?`, I have to think twice or all day thinking.

The problem is that real world program may have exception state you can't think of. If you write down a set of finite state; {A,B,C,D}.

  if A
    # For A, do nothing
  else
    # for B or C or D, kill a man
  end
  
It's sure that if not A, it's going to be B|C|D. But what if it isn't? You could get an exceptional Z which will kill a man too. You know A better anything "else".