Giter Site home page Giter Site logo

http's Introduction

http's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar godruoyi avatar mingyoung avatar overtrue avatar skys215 avatar summerblue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

http's Issues

三元表达式的问题

is_resource 结果是 true,那么 $contents 就是 true

应该是 $contents = \is_resource($contents) ? $contents : \fopen($contents, 'r'); 吧?

$contents = \is_resource($contents) ?: \fopen($contents, 'r');

Overtrue\Http\Support\XML 没有这个类

位置 Overtrue\Http\Responses\Response

引用了一个不存在的类 use Overtrue\Http\Support\XML,并且在 toArray 方法中使用了 XML::parse() 这个不存在的类(74行)。

Overtrue\Http\Support\Collection::dotGet()方法无法正确获取“.”号分割的key

版本:1.2.3
文件:src/Support/Collection.php
PHP版本:8.1
问题描述:
一个形如:

$config = new Collection([
    'a' => 'a0',
    'b' => [
            'b1' => 'b10'
           ]
]);

var_dump($config->get('b.b1')); //result is "null"

原因:

    /**
     * @param array      $array
     * @param string     $key
     * @param mixed|null $default
     *
     * @return mixed
     */
    public function dotGet($array, $key, $default = null)
    {
        if (is_null($key)) {
            return $array;
        }
        if (array_key_exists($key, $array)) {
            return $array[$key];
        }
        foreach (explode('.', $key) as $segment) {
            if (array_key_exists($segment, $array)) {
                $array = $array[$segment];
            } else {
                return $default;
            }
        }

        // 缺少循环完的返回 return $array;
    }

postJson方法data参数为空.请求时会传入body参数

示例:

return $this->client->postJson('extension/query', [], ['token' => $this->token]);

data为空,请求的body主体,应该是空的。
但是在Overtrue\Http\Traits\HasHttpRequests@fixJsonIssue里面设置了如下代码,会产生一个body内容为{}

            if (empty($options['json'])) {
                $options['body'] = \GuzzleHttp\json_encode($options['json'], JSON_FORCE_OBJECT);
            } else {
                $options['body'] = \GuzzleHttp\json_encode($options['json'], JSON_UNESCAPED_UNICODE);
            }

debug结果:

Content-Length: 2

使用

		return $this->client->request("extension/query?token={$this->token}", 'POST', [
			'headers' => ['Content-Type' => 'application/json']
		]);

debug结果:

Content-Length: 0 // 这才是正确的

Client类get方法的query参数换成options

Client类get方法的query参数换成options,之前调用是直接在第二个参数写query数组,现在版本更新后需要把所有get方法的第二个参数更改为['query' => [...]],请问有什么方法可以快速更新代码

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.