小编Nul*_*lji的帖子

检查git repo是否通过HTTP请求公开

对于我的项目,我需要知道git repo是否公开。我首先想到要使用HTTP请求,所以我使用的是邮递员,并且尝试使用HEAD方法处理多个URL。

当我发送请求时,看不到标题中的内容可以指示我是否失败。

当我向github发送一个私有项目的请求时,我收到状态404,因此对我来说是完美的,因为我知道这是一个私有项目。

但是,当我为gitlab执行此操作时,我收到状态200,然后被重定向。

我想知道是否有解决方案。

git httprequest http-headers

4
推荐指数
1
解决办法
365
查看次数

Create an object from a string array

I'm trying to create an object from a string array.

I've this string array :

let BaseArray = ['origin/develop', 'origin/master', 'toto/branch', 'tata/hello', 'tata/world'];
Run Code Online (Sandbox Code Playgroud)

and I would like to have an object like that :

{
  origin : ['develop', 'master'],
  toto : ['branch'],
  tata : ['hello', 'world']
}
Run Code Online (Sandbox Code Playgroud)

So for the moment, I did this :

let Obj = {};
let RemoteObj = {};
for (let CurrentIndex = 0; CurrentIndex < BaseArray.length; CurrentIndex++) {
    let Splits = BaseArray[CurrentIndex].split('/');
    if (Splits[0] && …
Run Code Online (Sandbox Code Playgroud)

javascript arrays object typescript

4
推荐指数
1
解决办法
96
查看次数