question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Boolean values casted to string

See original GitHub issue

Considering the following example code:

route('collector.get-messages', {
    body: true,
    collector: 1
});

It’s currently (v0.9.4) rendered as: http://example.com/collector/1/messages?body=true

In PHP it’s considered to be a string, and both "true" and "false" strictly equals to the boolean value true. I think this comes from the qs dependency stringify() function, if I want to send a PR, should I send it to this repository, or to qs ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
Max13commented, Oct 13, 2020

If Laravel’s route didn’t change Boolean values to an int, I would have been surprised ^^’

I would happily submit a PR, I will to read about encoders on qs and submit something.

Thanks for the debate

0reactions
bakerkretzmarcommented, Nov 6, 2020

No worries! I got it working, it’ll be included in v1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Boolean.prototype.toString() - JavaScript - MDN Web Docs
The toString() method returns a string representing the specified boolean value.
Read more >
Why can we cast bool to str? - python
In the case of str() , it delegates to the __str__ special method if present, which means that bool objects return the strings...
Read more >
Python | Ways to convert Boolean values to integer
Given a boolean value(s), write a Python program to convert them into an integer value or list respectively. Given below are a few...
Read more >
Java Program to convert boolean to integer
To convert boolean to integer, let us first declare a variable of boolean primitive. boolean bool = true;. Now, to convert it to...
Read more >
Logical Data Types - Boolean
Explicit Conversion¶. Boolean values can be cast explicitly to string or numeric values. String Conversion. TRUE is converted to 'true'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found