http header 中的小写和大写字母有区别吗?
例如两个标头:
test: 123
Test: 123
它们会被视为相同还是不同?
http header 中的小写和大写字母有区别吗?
例如两个标头:
test: 123
Test: 123
它们会被视为相同还是不同?
我正在使用kafkajs lib进行自动测试。
调用时await consumer.disconnect()
,命令执行约 5 秒,是否有安全快速断开连接的选项?
要通过 获取请求body: <json>
,您需要使用.use(express.json())
文本也一样。.use(express.text())
对于 xml,您已经需要包含库express-xml-bodyparser
,.use(xmlparser())
是否可以.use(<>)
在没有说明的情况下以某种方式接受任何类型的紧身连衣裤?
createProxyServer() {
const logger = new ConsoleLoggerService('proxy-server');
const proxy = httpProxy.createProxyServer({ changeOrigin: true });
const app = express();
app.all('*', (req, res, next) => {
logger.log(`Got request to ${req.path}, method=${req.method} `);
next();
});
registerServiceController(app);
app.all('*', async (req, res, next) => {
const { path } = req;
const proxyPath = findProxyPath(path);
const proxyHost = proxyMap[proxyPath];
if (proxyHost) {
logger.log(`Path [${path}] will be proxying to [${proxyHost}] host`);
proxy.web(req, res, {
target: {
protocol: 'https:',
host: proxyHost,
port: 443,
},
});
} else {
logger.error(`Proxy mapping for [${path}] not found, request not proxied`);
}
next();
})
.use(express.json())
.use(express.text())
.use(express.raw({ type: 'application/pdf', limit: '10mb' }))
.use(xmlparser())
.all('*', async (req, res, next) => {
const { path } = req;
const proxyPath = findProxyPath(path);
const proxyHost = proxyMap[proxyPath];
await ProxyStorageService.saveRequest(req, proxyHost);
});
app.listen(PORT);
logger.log(`Server is listening on port ${PORT}`);
}
有一个带有代码的 Card.jsx 文件
import React from 'react';
export default ({ title, text }) => {
if (!title && !text) {
return null;
}
const titleDom = title && <h4 className="card-title">{title}</h4>;
const textDom = text && <p className="card-text">{text}</p>;
return (
<div className="card">
<div className="card-body">
{titleDom}
{textDom}
</div>
</div>
);
};
和 index.jsx
import React from 'react';
import getCard from './Card';
getCard({ title: 'hi', text: 'how are you?' });
如何运行程序来运行 index.jsx 文件?
有一个文件 foo.ts,我用命令运行程序ts-node src/foo.ts
,但是它变得太大了,我想打破它。
渲染到第二个文件,它开始ts-node src/bar.ts
.
是否可以使用一个命令一次运行两个文件?
如何通过知道源分支和目标分支的提交哈希来找出哪些分支被合并到一个分支中
请用俄语解释为什么需要 cors “Access-Control-Allow-Credentials”,在互联网上用英文解释,我不明白它是什么意思
云车上有一种感觉,就是内存不够(但是没办法访问车或者增加可操作性) 怎么知道总共有多少内存,现在有多少是空闲的?我这样做:
long usedMBytes = Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory() / 1048576;
但答案是 1486355940 兆字节,在本地机器上(我决定调试),但在本地我只有 16 个 RAM
发送请求:
private void executeHttpGet(String url) throws IOException {
HttpURLConnection connection;
connection = (HttpURLConnection) (new URL(url).openConnection());
connection.setRequestProperty("Authorization","Bearer" + "<my_token>");
connection.connect();
connection.getContent();
System.out.println(connection.getRequestMethod());
}
但是请求失败并出现 401 错误 - 没有授权。但是通过一个同理的邮递员,答案来了。(get请求默认附上)
代码本身/文件夹和其他东西的颜色有很多设置,但我就是找不到在哪里更改行号的颜色
有一个日期:
moment().format('L')
如何回到当下?如果还有其他选项可以添加天数,它们也可以使用,但请不要进行字符串解析
new Date() 以下列格式返回日期:星期几、月份(单词)、日、年、小时、分钟、秒。是否有可能以某种方式一次创建某种格式的日期?(但不使用 getDay 等)例如:日、月、年 (20 08 2019)
如何在 Slack 中得到反应,知道它的时间戳?使用 Java。我的机器人可以看到新消息和有关该消息的所有信息,但知道旧消息的时间戳无法访问它
我通过邮递员发送请求,并收到 json 格式的响应,如何使用特定键存储特定字段?答案示例:
{
"uuid": "0#####17-###-####-####-a9#####0f5fc",
"price": {
"amount": "4974.49",
"currency": "RUB"
},
"flights": [
4
],
"alliance": "SkyTeam",
"price_per_pax": {
"adult": {
"amount": "4974.49",
"currency": "RUB"
},
"child": null,
"infant": null
},
"validating_carrier": "SU",
"refundable": false
}
从这个答案中,我需要保存 UUID,因为 他有一个联盟“天合联盟”(联盟可以改变,但我需要天合联盟)
我有一个文件,其中包含一行,每个值都用空格分隔,我需要用空格分隔每个值。在文件中,“ab c”行,你需要把它们放在一个单独的表上,其中会有一个值[a,b,c],这样我就可以找到字符的索引。
整行在这里:
Scanner in = new Scanner(new File(Paths));
List<String> string = Collections.singletonList(in.nextLine());
.split(" "); 方法是否有任何类比,但对于 list'a?
您需要在 Headers 选项卡中从网络获取文件。从 localStorage 我得到变量的值是这样的:
Object val = ((JavascriptExecutor) StoriesRunner.getWebDriver()).executeScript("return window.localStorage.getItem('search_counter')");
但我不知道如何从网络获取数据
我需要让时间(02:30)进入输入,分钟(150)是输出。以 hh:mm (01:30) 格式实现了相反的功能,分钟 (90)
SimpleDateFormat sdf = new SimpleDateFormat("mm");
try {
Date dt = sdf.parse("90");
sdf = new SimpleDateFormat("HH:mm");
System.out.println(sdf.format(dt));
} catch (ParseException e) {
e.printStackTrace();
}
启动后,会打开一个带有 chrome 的页面,在 .get () 中的字符应该适合的字段中,它显示“data:”。
package com.vk;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class FirstTest {
private static WebDriver driver;
@Before
public void setUp(){
System.setProperty("webdriver.chrome.driver", "C:\\Users\\r.gorbunov\\IdeaProjects\\auto_test\\chromedriver.exe");
driver = new ChromeDriver();
}
@Test
public void openTinkoffTravel() {
driver.get("https://www.tinkoff.ru/travel/flights/");
}
@After
public void close(){
driver.quit();
}
}
为什么我输入的网站打不开?这是终端输出的内容:
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) on port 29212
Only local connections are allowed.
org.openqa.selenium.WebDriverException: unknown error: Devtools port number file contents <53691> were in an unexpected format
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.13 seconds
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'
Driver info: driver.version: ChromeDriver
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at com.vk.FirstTest.setUp(FirstTest.java:17)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Process finished with exit code -1