小编use*_*310的帖子

如何从控制器发送nestjs应用程序中的错误代码?

除了200之外,我如何在nestjs中发送错误代码?我尝试在方法中注入响应对象,但没有方法发送错误。

save(@Body() body: any, @Res() response: Response): string {
    console.log("posting...")
    console.log(body)
    return "saving " + JSON.stringify(body)
}
Run Code Online (Sandbox Code Playgroud)

上面的代码发送带有 20X 状态的正文,我想发送不同的状态代码,例如 400 或 500。

javascript typescript nestjs

32
推荐指数
4
解决办法
8万
查看次数

用于微调器的RxBindings?

我是新的android和rxjava.我已经通过很多例子来讨论使用rxbindings的事件.比如这个

 RxView.clicks(b).subscribe(new Action1<Void>() {
                    @Override
                    public void call(Void aVoid) {
                        // do some work here
                    }
                });
Run Code Online (Sandbox Code Playgroud)

要么

RxTextView.textChanges(name)
            .subscribe(new Action1<String>() {
                @Override
                public void call(String value) {
                    // do some work with the updated text
                }
            });
Run Code Online (Sandbox Code Playgroud)

现在我想为android微调器做同样的事情.我想听itemselected事件.有人可以帮忙吗?

android rx-java rx-binding

12
推荐指数
1
解决办法
3477
查看次数

函数不会改变java中变量的值?

我知道java中的所有内容都是按值传递的,但下面的代码不应该打印2而不是1。

我所做的只是传递Integer和改变它的价值。为什么打印 1 而不是 2 ?

public static Integer x;

public static void doChange(Integer x) {
    x = 2;
}

public static void main(String arg[]) {
    x = 1;
    doChange(x);
    System.out.println(x);
}
Run Code Online (Sandbox Code Playgroud)

java variables static

3
推荐指数
1
解决办法
1万
查看次数